From bb6d5963e4c347399da5a11d36ff8923acb67d6e Mon Sep 17 00:00:00 2001 From: David Ferlay Date: Thu, 17 Nov 2022 14:45:57 +0100 Subject: [PATCH] Making errors more verbose + generating missing models (#35) --- account_abstract_payment.go | 126 +++++++ account_account.go | 48 +-- account_account_tag.go | 122 +++++++ account_account_template.go | 129 +++++++ account_account_type.go | 122 +++++++ account_aged_trial_balance.go | 125 +++++++ account_analytic_account.go | 72 ++-- account_analytic_line.go | 74 ++-- account_analytic_tag.go | 24 +- account_balance_report.go | 124 +++++++ account_bank_accounts_wizard.go | 122 +++++++ account_bank_statement.go | 151 +++++++++ account_bank_statement_cashbox.go | 119 +++++++ account_bank_statement_closebalance.go | 118 +++++++ account_bank_statement_import.go | 120 +++++++ ..._bank_statement_import_journal_creation.go | 153 +++++++++ account_bank_statement_line.go | 138 ++++++++ account_cash_rounding.go | 123 +++++++ account_cashbox_line.go | 122 +++++++ account_chart_template.go | 142 ++++++++ account_common_account_report.go | 124 +++++++ account_common_journal_report.go | 124 +++++++ account_common_partner_report.go | 124 +++++++ account_common_report.go | 123 +++++++ account_financial_report.go | 130 +++++++ account_financial_year_op.go | 124 +++++++ account_fiscal_position.go | 133 ++++++++ account_fiscal_position_account.go | 121 +++++++ account_fiscal_position_account_template.go | 121 +++++++ account_fiscal_position_tax.go | 121 +++++++ account_fiscal_position_tax_template.go | 121 +++++++ account_fiscal_position_template.go | 131 ++++++++ account_fr_fec.go | 123 +++++++ account_full_reconcile.go | 122 +++++++ account_group.go | 123 +++++++ account_invoice.go | 178 +++++----- account_invoice_confirm.go | 118 +++++++ account_invoice_line.go | 72 ++-- account_invoice_refund.go | 123 +++++++ account_invoice_report.go | 144 ++++++++ account_invoice_tax.go | 131 ++++++++ account_journal.go | 86 ++--- account_move.go | 133 ++++++++ account_move_line.go | 162 +++++++++ account_move_line_reconcile.go | 123 +++++++ account_move_line_reconcile_writeoff.go | 123 +++++++ account_move_reversal.go | 120 +++++++ account_opening.go | 124 +++++++ account_partial_reconcile.go | 127 +++++++ account_payment.go | 157 +++++++++ account_payment_method.go | 121 +++++++ account_payment_term.go | 124 +++++++ account_payment_term_line.go | 124 +++++++ account_print_journal.go | 125 +++++++ account_reconcile_model.go | 136 ++++++++ account_reconcile_model_template.go | 132 ++++++++ account_register_payments.go | 132 ++++++++ account_report_general_ledger.go | 126 +++++++ account_report_partner_ledger.go | 126 +++++++ account_tax.go | 138 ++++++++ account_tax_group.go | 120 +++++++ account_tax_report.go | 123 +++++++ account_tax_template.go | 138 ++++++++ account_unreconcile.go | 118 +++++++ accounting_report.go | 130 +++++++ autosales_config.go | 121 +++++++ autosales_config_line.go | 123 +++++++ barcode_nomenclature.go | 121 +++++++ barcode_rule.go | 125 +++++++ barcodes_barcode_events_mixin.go | 115 +++++++ base.go | 114 +++++++ base_import_import.go | 122 +++++++ base_import_tests_models_char.go | 119 +++++++ base_import_tests_models_char_noreadonly.go | 119 +++++++ base_import_tests_models_char_readonly.go | 119 +++++++ base_import_tests_models_char_required.go | 119 +++++++ base_import_tests_models_char_states.go | 119 +++++++ ..._import_tests_models_char_stillreadonly.go | 119 +++++++ base_import_tests_models_m2o.go | 119 +++++++ base_import_tests_models_m2o_related.go | 119 +++++++ base_import_tests_models_m2o_required.go | 119 +++++++ ...mport_tests_models_m2o_required_related.go | 119 +++++++ base_import_tests_models_o2m.go | 119 +++++++ base_import_tests_models_o2m_child.go | 120 +++++++ base_import_tests_models_preview.go | 121 +++++++ base_language_export.go | 124 +++++++ base_language_import.go | 123 +++++++ base_language_install.go | 121 +++++++ base_module_uninstall.go | 122 +++++++ base_module_update.go | 121 +++++++ base_module_upgrade.go | 119 +++++++ base_partner_merge_automatic_wizard.go | 132 ++++++++ base_partner_merge_line.go | 121 +++++++ base_update_translations.go | 119 +++++++ board_board.go | 114 +++++++ bus_bus.go | 120 +++++++ bus_presence.go | 118 +++++++ calendar_alarm.go | 123 +++++++ calendar_alarm_manager.go | 114 +++++++ calendar_attendee.go | 125 +++++++ calendar_contacts.go | 121 +++++++ calendar_event.go | 180 ++++++++++ calendar_event_type.go | 119 +++++++ cash_box_in.go | 121 +++++++ cash_box_out.go | 120 +++++++ change_password_user.go | 122 +++++++ change_password_wizard.go | 119 +++++++ crm_activity_report.go | 129 +++++++ crm_lead.go | 162 ++++----- crm_lead2opportunity_partner.go | 124 +++++++ crm_lead2opportunity_partner_mass.go | 127 +++++++ crm_lead_lost.go | 119 +++++++ crm_lead_tag.go | 22 +- crm_lost_reason.go | 120 +++++++ crm_merge_opportunity.go | 121 +++++++ crm_opportunity_report.go | 142 ++++++++ crm_partner_binding.go | 120 +++++++ crm_stage.go | 126 +++++++ crm_team.go | 170 ++++++++++ decimal_precision.go | 120 +++++++ decimal_precision_test.go | 121 +++++++ email_template_preview.go | 145 ++++++++ fetchmail_server.go | 136 ++++++++ format_address_mixin.go | 114 +++++++ generator/cmd/tmpl/model.tmpl | 4 +- hr_department.go | 144 ++++++++ hr_employee.go | 176 ++++++++++ hr_employee_category.go | 121 +++++++ hr_holidays.go | 154 +++++++++ hr_holidays_remaining_leaves_user.go | 118 +++++++ hr_holidays_status.go | 132 ++++++++ hr_holidays_summary_dept.go | 121 +++++++ hr_holidays_summary_employee.go | 121 +++++++ hr_job.go | 140 ++++++++ iap_account.go | 121 +++++++ im_livechat_channel.go | 133 ++++++++ im_livechat_channel_rule.go | 124 +++++++ im_livechat_report_channel.go | 125 +++++++ im_livechat_report_operator.go | 121 +++++++ ir_actions_act_url.go | 126 +++++++ ir_actions_act_window.go | 143 ++++++++ ir_actions_act_window_close.go | 124 +++++++ ir_actions_act_window_view.go | 123 +++++++ ir_actions_actions.go | 124 +++++++ ir_actions_client.go | 130 +++++++ ir_actions_report.go | 134 ++++++++ ir_actions_server.go | 138 ++++++++ ir_actions_todo.go | 122 +++++++ ir_attachment.go | 138 ++++++++ ir_autovacuum.go | 114 +++++++ ir_config_parameter.go | 120 +++++++ ir_cron.go | 148 ++++++++ ir_default.go | 123 +++++++ ir_exports.go | 121 +++++++ ir_exports_line.go | 120 +++++++ ir_fields_converter.go | 114 +++++++ ir_filters.go | 127 +++++++ ir_http.go | 114 +++++++ ir_logging.go | 126 +++++++ ir_mail_server.go | 127 +++++++ ir_model.go | 87 +++-- ir_model_access.go | 126 +++++++ ir_model_constraint.go | 125 +++++++ ir_model_data.go | 127 +++++++ ir_model_fields.go | 126 ++++--- ir_model_relation.go | 123 +++++++ ir_module_category.go | 128 +++++++ ir_module_module.go | 72 ++-- ir_module_module_dependency.go | 122 +++++++ ir_module_module_exclusion.go | 122 +++++++ ir_property.go | 129 +++++++ ir_qweb.go | 114 +++++++ ir_qweb_field.go | 114 +++++++ ir_qweb_field_barcode.go | 114 +++++++ ir_qweb_field_contact.go | 114 +++++++ ir_qweb_field_date.go | 114 +++++++ ir_qweb_field_datetime.go | 114 +++++++ ir_qweb_field_duration.go | 114 +++++++ ir_qweb_field_float.go | 114 +++++++ ir_qweb_field_float_time.go | 114 +++++++ ir_qweb_field_html.go | 114 +++++++ ir_qweb_field_image.go | 114 +++++++ ir_qweb_field_integer.go | 114 +++++++ ir_qweb_field_many2one.go | 114 +++++++ ir_qweb_field_monetary.go | 114 +++++++ ir_qweb_field_qweb.go | 114 +++++++ ir_qweb_field_relative.go | 114 +++++++ ir_qweb_field_selection.go | 114 +++++++ ir_qweb_field_text.go | 114 +++++++ ir_rule.go | 128 +++++++ ir_sequence.go | 131 ++++++++ ir_sequence_date_range.go | 123 +++++++ ir_server_object_lines.go | 122 +++++++ ir_translation.go | 124 +++++++ ir_ui_menu.go | 130 +++++++ ir_ui_view.go | 136 ++++++++ ir_ui_view_custom.go | 121 +++++++ link_tracker.go | 134 ++++++++ link_tracker_click.go | 125 +++++++ link_tracker_code.go | 120 +++++++ mail_activity.go | 135 ++++++++ mail_activity_mixin.go | 120 +++++++ mail_activity_type.go | 127 +++++++ mail_alias.go | 127 +++++++ mail_alias_mixin.go | 128 +++++++ mail_channel.go | 162 +++++++++ mail_channel_partner.go | 125 +++++++ mail_compose_message.go | 159 +++++++++ mail_followers.go | 4 +- mail_mail.go | 162 +++++++++ mail_mail_statistics.go | 136 ++++++++ mail_mass_mailing.go | 155 +++++++++ mail_mass_mailing_campaign.go | 142 ++++++++ mail_mass_mailing_contact.go | 139 ++++++++ mail_mass_mailing_list.go | 121 +++++++ mail_mass_mailing_stage.go | 120 +++++++ mail_mass_mailing_tag.go | 120 +++++++ mail_mass_mailing_test.go | 120 +++++++ mail_message.go | 147 ++++++++ mail_message_subtype.go | 127 +++++++ mail_notification.go | 119 +++++++ mail_shortcode.go | 123 +++++++ mail_statistics_report.go | 124 +++++++ mail_template.go | 143 ++++++++ mail_test.go | 141 ++++++++ mail_test_simple.go | 132 ++++++++ mail_thread.go | 125 +++++++ mail_tracking_value.go | 134 ++++++++ mail_wizard_invite.go | 124 +++++++ payment_acquirer.go | 153 +++++++++ payment_icon.go | 122 +++++++ payment_token.go | 126 +++++++ payment_transaction.go | 144 ++++++++ portal_mixin.go | 115 +++++++ portal_wizard.go | 121 +++++++ portal_wizard_user.go | 123 +++++++ procurement_group.go | 122 +++++++ procurement_rule.go | 136 ++++++++ product_attribute.go | 123 +++++++ product_attribute_line.go | 121 +++++++ product_attribute_price.go | 121 +++++++ product_attribute_value.go | 124 +++++++ product_category.go | 137 ++++++++ product_packaging.go | 123 +++++++ product_price_history.go | 122 +++++++ product_price_list.go | 124 +++++++ product_pricelist.go | 126 +++++++ product_pricelist_item.go | 140 ++++++++ product_product.go | 240 ++++++------- product_putaway.go | 120 +++++++ product_removal.go | 120 +++++++ product_supplierinfo.go | 48 +-- product_template.go | 215 ++++++++++++ product_uom.go | 125 +++++++ product_uom_categ.go | 119 +++++++ project_project.go | 134 ++++---- project_tags.go | 120 +++++++ project_task.go | 148 ++++---- project_task_merge_wizard.go | 124 +++++++ project_task_type.go | 128 +++++++ publisher_warranty_contract.go | 114 +++++++ purchase_order.go | 165 +++++++++ purchase_order_line.go | 144 ++++++++ purchase_report.go | 140 ++++++++ queue_job.go | 155 +++++++++ queue_job_channel.go | 122 +++++++ queue_job_function.go | 117 +++++++ queue_requeue_job.go | 119 +++++++ rating_mixin.go | 119 +++++++ rating_rating.go | 135 ++++++++ report_account_report_agedpartnerbalance.go | 114 +++++++ report_account_report_financial.go | 114 +++++++ report_account_report_generalledger.go | 114 +++++++ report_account_report_journal.go | 114 +++++++ report_account_report_overdue.go | 114 +++++++ report_account_report_partnerledger.go | 114 +++++++ report_account_report_tax.go | 114 +++++++ report_account_report_trialbalance.go | 114 +++++++ report_all_channels_sales.go | 129 +++++++ report_base_report_irmodulereference.go | 114 +++++++ report_hr_holidays_report_holidayssummary.go | 114 +++++++ report_paperformat.go | 132 ++++++++ report_product_report_pricelist.go | 114 +++++++ report_project_task_user.go | 136 ++++++++ report_sale_report_saleproforma.go | 114 +++++++ report_stock_forecast.go | 119 +++++++ res_bank.go | 129 +++++++ res_company.go | 176 +++++----- res_config.go | 118 +++++++ res_config_installer.go | 118 +++++++ res_config_settings.go | 272 +++++++++++++++ res_country.go | 129 +++++++ res_country_group.go | 121 +++++++ res_country_state.go | 121 +++++++ res_currency.go | 129 +++++++ res_currency_rate.go | 122 +++++++ res_groups.go | 132 ++++++++ res_lang.go | 129 +++++++ res_partner.go | 266 +++++++-------- res_partner_bank.go | 129 +++++++ res_partner_category.go | 34 +- res_partner_industry.go | 121 +++++++ res_partner_title.go | 120 +++++++ res_request_link.go | 121 +++++++ res_users.go | 318 +++++++++--------- res_users_log.go | 118 +++++++ resource_calendar.go | 123 +++++++ resource_calendar_attendance.go | 125 +++++++ resource_calendar_leaves.go | 126 +++++++ resource_mixin.go | 117 +++++++ resource_resource.go | 125 +++++++ resource_test.go | 122 +++++++ sale_advance_payment_inv.go | 124 +++++++ sale_layout_category.go | 122 +++++++ sale_order.go | 186 ++++++++++ sale_order_line.go | 160 +++++++++ sale_report.go | 142 ++++++++ sms_api.go | 114 +++++++ sms_send_sms.go | 120 +++++++ sparse_fields_test.go | 125 +++++++ stock_backorder_confirmation.go | 119 +++++++ stock_change_product_qty.go | 124 +++++++ stock_change_standard_price.go | 121 +++++++ stock_fixed_putaway_strat.go | 122 +++++++ stock_immediate_transfer.go | 119 +++++++ stock_incoterms.go | 121 +++++++ stock_inventory.go | 134 ++++++++ stock_inventory_line.go | 134 ++++++++ stock_location.go | 140 ++++++++ stock_location_path.go | 131 ++++++++ stock_location_route.go | 133 ++++++++ stock_move.go | 183 ++++++++++ stock_move_line.go | 144 ++++++++ stock_overprocessed_transfer.go | 120 +++++++ stock_picking.go | 172 ++++++++++ stock_picking_type.go | 143 ++++++++ stock_production_lot.go | 135 ++++++++ stock_quant.go | 129 +++++++ stock_quant_package.go | 130 +++++++ stock_quantity_history.go | 120 +++++++ stock_return_picking.go | 124 +++++++ stock_return_picking_line.go | 124 +++++++ stock_scheduler_compute.go | 118 +++++++ stock_scrap.go | 133 ++++++++ stock_traceability_report.go | 118 +++++++ stock_warehouse.go | 146 ++++++++ stock_warehouse_orderpoint.go | 131 ++++++++ stock_warn_insufficient_qty.go | 117 +++++++ stock_warn_insufficient_qty_scrap.go | 122 +++++++ tax_adjustments_wizard.go | 127 +++++++ utm_campaign.go | 119 +++++++ utm_medium.go | 120 +++++++ utm_mixin.go | 117 +++++++ utm_source.go | 119 +++++++ validate_account_move.go | 118 +++++++ web_editor_converter_test.go | 130 +++++++ web_editor_converter_test_sub.go | 119 +++++++ web_planner.go | 126 +++++++ web_tour_tour.go | 116 +++++++ wizard_ir_model_menu_create.go | 120 +++++++ wizard_multi_charts_accounts.go | 133 ++++++++ 361 files changed, 44327 insertions(+), 1161 deletions(-) create mode 100644 account_abstract_payment.go create mode 100644 account_account_tag.go create mode 100644 account_account_template.go create mode 100644 account_account_type.go create mode 100644 account_aged_trial_balance.go create mode 100644 account_balance_report.go create mode 100644 account_bank_accounts_wizard.go create mode 100644 account_bank_statement.go create mode 100644 account_bank_statement_cashbox.go create mode 100644 account_bank_statement_closebalance.go create mode 100644 account_bank_statement_import.go create mode 100644 account_bank_statement_import_journal_creation.go create mode 100644 account_bank_statement_line.go create mode 100644 account_cash_rounding.go create mode 100644 account_cashbox_line.go create mode 100644 account_chart_template.go create mode 100644 account_common_account_report.go create mode 100644 account_common_journal_report.go create mode 100644 account_common_partner_report.go create mode 100644 account_common_report.go create mode 100644 account_financial_report.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_account_template.go create mode 100644 account_fiscal_position_tax.go create mode 100644 account_fiscal_position_tax_template.go create mode 100644 account_fiscal_position_template.go create mode 100644 account_fr_fec.go create mode 100644 account_full_reconcile.go create mode 100644 account_group.go create mode 100644 account_invoice_confirm.go create mode 100644 account_invoice_refund.go create mode 100644 account_invoice_report.go create mode 100644 account_invoice_tax.go create mode 100644 account_move.go create mode 100644 account_move_line.go create mode 100644 account_move_line_reconcile.go create mode 100644 account_move_line_reconcile_writeoff.go create mode 100644 account_move_reversal.go create mode 100644 account_opening.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_term.go create mode 100644 account_payment_term_line.go create mode 100644 account_print_journal.go create mode 100644 account_reconcile_model.go create mode 100644 account_reconcile_model_template.go create mode 100644 account_register_payments.go create mode 100644 account_report_general_ledger.go create mode 100644 account_report_partner_ledger.go create mode 100644 account_tax.go create mode 100644 account_tax_group.go create mode 100644 account_tax_report.go create mode 100644 account_tax_template.go create mode 100644 account_unreconcile.go create mode 100644 accounting_report.go create mode 100644 autosales_config.go create mode 100644 autosales_config_line.go create mode 100644 barcode_nomenclature.go create mode 100644 barcode_rule.go create mode 100644 barcodes_barcode_events_mixin.go create mode 100644 base.go create mode 100644 base_import_import.go create mode 100644 base_import_tests_models_char.go create mode 100644 base_import_tests_models_char_noreadonly.go create mode 100644 base_import_tests_models_char_readonly.go create mode 100644 base_import_tests_models_char_required.go create mode 100644 base_import_tests_models_char_states.go create mode 100644 base_import_tests_models_char_stillreadonly.go create mode 100644 base_import_tests_models_m2o.go create mode 100644 base_import_tests_models_m2o_related.go create mode 100644 base_import_tests_models_m2o_required.go create mode 100644 base_import_tests_models_m2o_required_related.go create mode 100644 base_import_tests_models_o2m.go create mode 100644 base_import_tests_models_o2m_child.go create mode 100644 base_import_tests_models_preview.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_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 base_update_translations.go create mode 100644 board_board.go create mode 100644 bus_bus.go create mode 100644 bus_presence.go create mode 100644 calendar_alarm.go create mode 100644 calendar_alarm_manager.go create mode 100644 calendar_attendee.go create mode 100644 calendar_contacts.go create mode 100644 calendar_event.go create mode 100644 calendar_event_type.go create mode 100644 cash_box_in.go create mode 100644 cash_box_out.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_lead2opportunity_partner.go create mode 100644 crm_lead2opportunity_partner_mass.go create mode 100644 crm_lead_lost.go create mode 100644 crm_lost_reason.go create mode 100644 crm_merge_opportunity.go create mode 100644 crm_opportunity_report.go create mode 100644 crm_partner_binding.go create mode 100644 crm_stage.go create mode 100644 crm_team.go create mode 100644 decimal_precision.go create mode 100644 decimal_precision_test.go create mode 100644 email_template_preview.go create mode 100644 fetchmail_server.go create mode 100644 format_address_mixin.go create mode 100644 hr_department.go create mode 100644 hr_employee.go create mode 100644 hr_employee_category.go create mode 100644 hr_holidays.go create mode 100644 hr_holidays_remaining_leaves_user.go create mode 100644 hr_holidays_status.go create mode 100644 hr_holidays_summary_dept.go create mode 100644 hr_holidays_summary_employee.go create mode 100644 hr_job.go create mode 100644 iap_account.go create mode 100644 im_livechat_channel.go create mode 100644 im_livechat_channel_rule.go create mode 100644 im_livechat_report_channel.go create mode 100644 im_livechat_report_operator.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_attachment.go create mode 100644 ir_autovacuum.go create mode 100644 ir_config_parameter.go create mode 100644 ir_cron.go create mode 100644 ir_default.go create mode 100644 ir_exports.go create mode 100644 ir_exports_line.go create mode 100644 ir_fields_converter.go create mode 100644 ir_filters.go create mode 100644 ir_http.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_relation.go create mode 100644 ir_module_category.go create mode 100644 ir_module_module_dependency.go create mode 100644 ir_module_module_exclusion.go create mode 100644 ir_property.go create mode 100644 ir_qweb.go create mode 100644 ir_qweb_field.go create mode 100644 ir_qweb_field_barcode.go create mode 100644 ir_qweb_field_contact.go create mode 100644 ir_qweb_field_date.go create mode 100644 ir_qweb_field_datetime.go create mode 100644 ir_qweb_field_duration.go create mode 100644 ir_qweb_field_float.go create mode 100644 ir_qweb_field_float_time.go create mode 100644 ir_qweb_field_html.go create mode 100644 ir_qweb_field_image.go create mode 100644 ir_qweb_field_integer.go create mode 100644 ir_qweb_field_many2one.go create mode 100644 ir_qweb_field_monetary.go create mode 100644 ir_qweb_field_qweb.go create mode 100644 ir_qweb_field_relative.go create mode 100644 ir_qweb_field_selection.go create mode 100644 ir_qweb_field_text.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_server_object_lines.go create mode 100644 ir_translation.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 link_tracker.go create mode 100644 link_tracker_click.go create mode 100644 link_tracker_code.go create mode 100644 mail_activity.go create mode 100644 mail_activity_mixin.go create mode 100644 mail_activity_type.go create mode 100644 mail_alias.go create mode 100644 mail_alias_mixin.go create mode 100644 mail_channel.go create mode 100644 mail_channel_partner.go create mode 100644 mail_compose_message.go create mode 100644 mail_mail.go create mode 100644 mail_mail_statistics.go create mode 100644 mail_mass_mailing.go create mode 100644 mail_mass_mailing_campaign.go create mode 100644 mail_mass_mailing_contact.go create mode 100644 mail_mass_mailing_list.go create mode 100644 mail_mass_mailing_stage.go create mode 100644 mail_mass_mailing_tag.go create mode 100644 mail_mass_mailing_test.go create mode 100644 mail_message.go create mode 100644 mail_message_subtype.go create mode 100644 mail_notification.go create mode 100644 mail_shortcode.go create mode 100644 mail_statistics_report.go create mode 100644 mail_template.go create mode 100644 mail_test.go create mode 100644 mail_test_simple.go create mode 100644 mail_thread.go create mode 100644 mail_tracking_value.go create mode 100644 mail_wizard_invite.go create mode 100644 payment_acquirer.go create mode 100644 payment_icon.go create mode 100644 payment_token.go create mode 100644 payment_transaction.go create mode 100644 portal_mixin.go create mode 100644 portal_wizard.go create mode 100644 portal_wizard_user.go create mode 100644 procurement_group.go create mode 100644 procurement_rule.go create mode 100644 product_attribute.go create mode 100644 product_attribute_line.go create mode 100644 product_attribute_price.go create mode 100644 product_attribute_value.go create mode 100644 product_category.go create mode 100644 product_packaging.go create mode 100644 product_price_history.go create mode 100644 product_price_list.go create mode 100644 product_pricelist.go create mode 100644 product_pricelist_item.go create mode 100644 product_putaway.go create mode 100644 product_removal.go create mode 100644 product_template.go create mode 100644 product_uom.go create mode 100644 product_uom_categ.go create mode 100644 project_tags.go create mode 100644 project_task_merge_wizard.go create mode 100644 project_task_type.go create mode 100644 publisher_warranty_contract.go create mode 100644 purchase_order.go create mode 100644 purchase_order_line.go create mode 100644 purchase_report.go create mode 100644 queue_job.go create mode 100644 queue_job_channel.go create mode 100644 queue_job_function.go create mode 100644 queue_requeue_job.go create mode 100644 rating_mixin.go create mode 100644 rating_rating.go create mode 100644 report_account_report_agedpartnerbalance.go create mode 100644 report_account_report_financial.go create mode 100644 report_account_report_generalledger.go create mode 100644 report_account_report_journal.go create mode 100644 report_account_report_overdue.go create mode 100644 report_account_report_partnerledger.go create mode 100644 report_account_report_tax.go create mode 100644 report_account_report_trialbalance.go create mode 100644 report_all_channels_sales.go create mode 100644 report_base_report_irmodulereference.go create mode 100644 report_hr_holidays_report_holidayssummary.go create mode 100644 report_paperformat.go create mode 100644 report_product_report_pricelist.go create mode 100644 report_project_task_user.go create mode 100644 report_sale_report_saleproforma.go create mode 100644 report_stock_forecast.go create mode 100644 res_bank.go create mode 100644 res_config.go create mode 100644 res_config_installer.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_groups.go create mode 100644 res_lang.go create mode 100644 res_partner_bank.go create mode 100644 res_partner_industry.go create mode 100644 res_partner_title.go create mode 100644 res_request_link.go create mode 100644 res_users_log.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_mixin.go create mode 100644 resource_resource.go create mode 100644 resource_test.go create mode 100644 sale_advance_payment_inv.go create mode 100644 sale_layout_category.go create mode 100644 sale_order.go create mode 100644 sale_order_line.go create mode 100644 sale_report.go create mode 100644 sms_api.go create mode 100644 sms_send_sms.go create mode 100644 sparse_fields_test.go create mode 100644 stock_backorder_confirmation.go create mode 100644 stock_change_product_qty.go create mode 100644 stock_change_standard_price.go create mode 100644 stock_fixed_putaway_strat.go create mode 100644 stock_immediate_transfer.go create mode 100644 stock_incoterms.go create mode 100644 stock_inventory.go create mode 100644 stock_inventory_line.go create mode 100644 stock_location.go create mode 100644 stock_location_path.go create mode 100644 stock_location_route.go create mode 100644 stock_move.go create mode 100644 stock_move_line.go create mode 100644 stock_overprocessed_transfer.go create mode 100644 stock_picking.go create mode 100644 stock_picking_type.go create mode 100644 stock_production_lot.go create mode 100644 stock_quant.go create mode 100644 stock_quant_package.go create mode 100644 stock_quantity_history.go create mode 100644 stock_return_picking.go create mode 100644 stock_return_picking_line.go create mode 100644 stock_scheduler_compute.go create mode 100644 stock_scrap.go create mode 100644 stock_traceability_report.go create mode 100644 stock_warehouse.go create mode 100644 stock_warehouse_orderpoint.go create mode 100644 stock_warn_insufficient_qty.go create mode 100644 stock_warn_insufficient_qty_scrap.go create mode 100644 tax_adjustments_wizard.go create mode 100644 utm_campaign.go create mode 100644 utm_medium.go create mode 100644 utm_mixin.go create mode 100644 utm_source.go create mode 100644 validate_account_move.go create mode 100644 web_editor_converter_test.go create mode 100644 web_editor_converter_test_sub.go create mode 100644 web_planner.go create mode 100644 web_tour_tour.go create mode 100644 wizard_ir_model_menu_create.go create mode 100644 wizard_multi_charts_accounts.go diff --git a/account_abstract_payment.go b/account_abstract_payment.go new file mode 100644 index 00000000..b540c597 --- /dev/null +++ b/account_abstract_payment.go @@ -0,0 +1,126 @@ +package odoo + +import ( + "fmt" +) + +// AccountAbstractPayment represents account.abstract.payment model. +type AccountAbstractPayment struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + Amount *Float `xmlrpc:"amount,omitempty"` + Communication *String `xmlrpc:"communication,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + HidePaymentMethod *Bool `xmlrpc:"hide_payment_method,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + JournalId *Many2One `xmlrpc:"journal_id,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PartnerType *Selection `xmlrpc:"partner_type,omitempty"` + PaymentDate *Time `xmlrpc:"payment_date,omitempty"` + PaymentMethodCode *String `xmlrpc:"payment_method_code,omitempty"` + PaymentMethodId *Many2One `xmlrpc:"payment_method_id,omitempty"` + PaymentType *Selection `xmlrpc:"payment_type,omitempty"` +} + +// AccountAbstractPayments represents array of account.abstract.payment model. +type AccountAbstractPayments []AccountAbstractPayment + +// AccountAbstractPaymentModel is the odoo model name. +const AccountAbstractPaymentModel = "account.abstract.payment" + +// Many2One convert AccountAbstractPayment to *Many2One. +func (aap *AccountAbstractPayment) Many2One() *Many2One { + return NewMany2One(aap.Id.Get(), "") +} + +// CreateAccountAbstractPayment creates a new account.abstract.payment model and returns its id. +func (c *Client) CreateAccountAbstractPayment(aap *AccountAbstractPayment) (int64, error) { + return c.Create(AccountAbstractPaymentModel, aap) +} + +// UpdateAccountAbstractPayment updates an existing account.abstract.payment record. +func (c *Client) UpdateAccountAbstractPayment(aap *AccountAbstractPayment) error { + return c.UpdateAccountAbstractPayments([]int64{aap.Id.Get()}, aap) +} + +// UpdateAccountAbstractPayments updates existing account.abstract.payment records. +// All records (represented by ids) will be updated by aap values. +func (c *Client) UpdateAccountAbstractPayments(ids []int64, aap *AccountAbstractPayment) error { + return c.Update(AccountAbstractPaymentModel, ids, aap) +} + +// DeleteAccountAbstractPayment deletes an existing account.abstract.payment record. +func (c *Client) DeleteAccountAbstractPayment(id int64) error { + return c.DeleteAccountAbstractPayments([]int64{id}) +} + +// DeleteAccountAbstractPayments deletes existing account.abstract.payment records. +func (c *Client) DeleteAccountAbstractPayments(ids []int64) error { + return c.Delete(AccountAbstractPaymentModel, ids) +} + +// GetAccountAbstractPayment gets account.abstract.payment existing record. +func (c *Client) GetAccountAbstractPayment(id int64) (*AccountAbstractPayment, error) { + aaps, err := c.GetAccountAbstractPayments([]int64{id}) + if err != nil { + return nil, err + } + if aaps != nil && len(*aaps) > 0 { + return &((*aaps)[0]), nil + } + return nil, fmt.Errorf("id %v of account.abstract.payment not found", id) +} + +// GetAccountAbstractPayments gets account.abstract.payment existing records. +func (c *Client) GetAccountAbstractPayments(ids []int64) (*AccountAbstractPayments, error) { + aaps := &AccountAbstractPayments{} + if err := c.Read(AccountAbstractPaymentModel, ids, nil, aaps); err != nil { + return nil, err + } + return aaps, nil +} + +// FindAccountAbstractPayment finds account.abstract.payment record by querying it with criteria. +func (c *Client) FindAccountAbstractPayment(criteria *Criteria) (*AccountAbstractPayment, error) { + aaps := &AccountAbstractPayments{} + if err := c.SearchRead(AccountAbstractPaymentModel, criteria, NewOptions().Limit(1), aaps); err != nil { + return nil, err + } + if aaps != nil && len(*aaps) > 0 { + return &((*aaps)[0]), nil + } + return nil, fmt.Errorf("no account.abstract.payment was found with criteria %v", criteria) +} + +// FindAccountAbstractPayments finds account.abstract.payment records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountAbstractPayments(criteria *Criteria, options *Options) (*AccountAbstractPayments, error) { + aaps := &AccountAbstractPayments{} + if err := c.SearchRead(AccountAbstractPaymentModel, criteria, options, aaps); err != nil { + return nil, err + } + return aaps, nil +} + +// FindAccountAbstractPaymentIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountAbstractPaymentIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(AccountAbstractPaymentModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindAccountAbstractPaymentId finds record id by querying it with criteria. +func (c *Client) FindAccountAbstractPaymentId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountAbstractPaymentModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.abstract.payment was found with criteria %v and options %v", criteria, options) +} diff --git a/account_account.go b/account_account.go index e2da4e38..a73f8057 100644 --- a/account_account.go +++ b/account_account.go @@ -6,28 +6,28 @@ import ( // AccountAccount represents account.account model. type AccountAccount struct { - LastUpdate *Time `xmlrpc:"__last_update,omptempty"` - Code *String `xmlrpc:"code,omptempty"` - CompanyId *Many2One `xmlrpc:"company_id,omptempty"` - CreateDate *Time `xmlrpc:"create_date,omptempty"` - CreateUid *Many2One `xmlrpc:"create_uid,omptempty"` - CurrencyId *Many2One `xmlrpc:"currency_id,omptempty"` - Deprecated *Bool `xmlrpc:"deprecated,omptempty"` - DisplayName *String `xmlrpc:"display_name,omptempty"` - GroupId *Many2One `xmlrpc:"group_id,omptempty"` - Id *Int `xmlrpc:"id,omptempty"` - InternalType *Selection `xmlrpc:"internal_type,omptempty"` - LastTimeEntriesChecked *Time `xmlrpc:"last_time_entries_checked,omptempty"` - Name *String `xmlrpc:"name,omptempty"` - Note *String `xmlrpc:"note,omptempty"` - OpeningCredit *Float `xmlrpc:"opening_credit,omptempty"` - OpeningDebit *Float `xmlrpc:"opening_debit,omptempty"` - Reconcile *Bool `xmlrpc:"reconcile,omptempty"` - TagIds *Relation `xmlrpc:"tag_ids,omptempty"` - TaxIds *Relation `xmlrpc:"tax_ids,omptempty"` - UserTypeId *Many2One `xmlrpc:"user_type_id,omptempty"` - WriteDate *Time `xmlrpc:"write_date,omptempty"` - WriteUid *Many2One `xmlrpc:"write_uid,omptempty"` + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + Code *String `xmlrpc:"code,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"` + Deprecated *Bool `xmlrpc:"deprecated,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + GroupId *Many2One `xmlrpc:"group_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + InternalType *Selection `xmlrpc:"internal_type,omitempty"` + LastTimeEntriesChecked *Time `xmlrpc:"last_time_entries_checked,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Note *String `xmlrpc:"note,omitempty"` + OpeningCredit *Float `xmlrpc:"opening_credit,omitempty"` + OpeningDebit *Float `xmlrpc:"opening_debit,omitempty"` + Reconcile *Bool `xmlrpc:"reconcile,omitempty"` + TagIds *Relation `xmlrpc:"tag_ids,omitempty"` + TaxIds *Relation `xmlrpc:"tax_ids,omitempty"` + UserTypeId *Many2One `xmlrpc:"user_type_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` } // AccountAccounts represents array of account.account model. @@ -97,7 +97,7 @@ func (c *Client) FindAccountAccount(criteria *Criteria) (*AccountAccount, error) if aas != nil && len(*aas) > 0 { return &((*aas)[0]), nil } - return nil, fmt.Errorf("account.account was not found") + return nil, fmt.Errorf("no account.account was found with criteria %v", criteria) } // FindAccountAccounts finds account.account records by querying it @@ -129,5 +129,5 @@ func (c *Client) FindAccountAccountId(criteria *Criteria, options *Options) (int if len(ids) > 0 { return ids[0], nil } - return -1, fmt.Errorf("account.account was not found") + return -1, fmt.Errorf("no account.account was found with criteria %v and options %v", criteria, options) } diff --git a/account_account_tag.go b/account_account_tag.go new file mode 100644 index 00000000..a4d51d4c --- /dev/null +++ b/account_account_tag.go @@ -0,0 +1,122 @@ +package odoo + +import ( + "fmt" +) + +// AccountAccountTag represents account.account.tag model. +type AccountAccountTag struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + Active *Bool `xmlrpc:"active,omitempty"` + Applicability *Selection `xmlrpc:"applicability,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"` + 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) { + return c.Create(AccountAccountTagModel, aat) +} + +// 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) +} + +// 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 + } + if aats != nil && len(*aats) > 0 { + return &((*aats)[0]), nil + } + return nil, fmt.Errorf("id %v of account.account.tag not found", id) +} + +// 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 + } + if aats != nil && len(*aats) > 0 { + return &((*aats)[0]), nil + } + return nil, fmt.Errorf("no account.account.tag was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(AccountAccountTagModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.account.tag was found with criteria %v and options %v", criteria, options) +} diff --git a/account_account_template.go b/account_account_template.go new file mode 100644 index 00000000..d7ff4b2a --- /dev/null +++ b/account_account_template.go @@ -0,0 +1,129 @@ +package odoo + +import ( + "fmt" +) + +// AccountAccountTemplate represents account.account.template model. +type AccountAccountTemplate struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + ChartTemplateId *Many2One `xmlrpc:"chart_template_id,omitempty"` + Code *String `xmlrpc:"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"` + GroupId *Many2One `xmlrpc:"group_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Nocreate *Bool `xmlrpc:"nocreate,omitempty"` + Note *String `xmlrpc:"note,omitempty"` + Reconcile *Bool `xmlrpc:"reconcile,omitempty"` + TagIds *Relation `xmlrpc:"tag_ids,omitempty"` + TaxIds *Relation `xmlrpc:"tax_ids,omitempty"` + UserTypeId *Many2One `xmlrpc:"user_type_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountAccountTemplates represents array of account.account.template model. +type AccountAccountTemplates []AccountAccountTemplate + +// AccountAccountTemplateModel is the odoo model name. +const AccountAccountTemplateModel = "account.account.template" + +// Many2One convert AccountAccountTemplate to *Many2One. +func (aat *AccountAccountTemplate) Many2One() *Many2One { + return NewMany2One(aat.Id.Get(), "") +} + +// CreateAccountAccountTemplate creates a new account.account.template model and returns its id. +func (c *Client) CreateAccountAccountTemplate(aat *AccountAccountTemplate) (int64, error) { + return c.Create(AccountAccountTemplateModel, aat) +} + +// UpdateAccountAccountTemplate updates an existing account.account.template record. +func (c *Client) UpdateAccountAccountTemplate(aat *AccountAccountTemplate) error { + return c.UpdateAccountAccountTemplates([]int64{aat.Id.Get()}, aat) +} + +// UpdateAccountAccountTemplates updates existing account.account.template records. +// All records (represented by ids) will be updated by aat values. +func (c *Client) UpdateAccountAccountTemplates(ids []int64, aat *AccountAccountTemplate) error { + return c.Update(AccountAccountTemplateModel, ids, aat) +} + +// DeleteAccountAccountTemplate deletes an existing account.account.template record. +func (c *Client) DeleteAccountAccountTemplate(id int64) error { + return c.DeleteAccountAccountTemplates([]int64{id}) +} + +// DeleteAccountAccountTemplates deletes existing account.account.template records. +func (c *Client) DeleteAccountAccountTemplates(ids []int64) error { + return c.Delete(AccountAccountTemplateModel, ids) +} + +// GetAccountAccountTemplate gets account.account.template existing record. +func (c *Client) GetAccountAccountTemplate(id int64) (*AccountAccountTemplate, error) { + aats, err := c.GetAccountAccountTemplates([]int64{id}) + if err != nil { + return nil, err + } + if aats != nil && len(*aats) > 0 { + return &((*aats)[0]), nil + } + return nil, fmt.Errorf("id %v of account.account.template not found", id) +} + +// GetAccountAccountTemplates gets account.account.template existing records. +func (c *Client) GetAccountAccountTemplates(ids []int64) (*AccountAccountTemplates, error) { + aats := &AccountAccountTemplates{} + if err := c.Read(AccountAccountTemplateModel, ids, nil, aats); err != nil { + return nil, err + } + return aats, nil +} + +// FindAccountAccountTemplate finds account.account.template record by querying it with criteria. +func (c *Client) FindAccountAccountTemplate(criteria *Criteria) (*AccountAccountTemplate, error) { + aats := &AccountAccountTemplates{} + if err := c.SearchRead(AccountAccountTemplateModel, criteria, NewOptions().Limit(1), aats); err != nil { + return nil, err + } + if aats != nil && len(*aats) > 0 { + return &((*aats)[0]), nil + } + return nil, fmt.Errorf("no account.account.template was found with criteria %v", criteria) +} + +// FindAccountAccountTemplates finds account.account.template records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountAccountTemplates(criteria *Criteria, options *Options) (*AccountAccountTemplates, error) { + aats := &AccountAccountTemplates{} + if err := c.SearchRead(AccountAccountTemplateModel, criteria, options, aats); err != nil { + return nil, err + } + return aats, nil +} + +// FindAccountAccountTemplateIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountAccountTemplateIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(AccountAccountTemplateModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindAccountAccountTemplateId finds record id by querying it with criteria. +func (c *Client) FindAccountAccountTemplateId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountAccountTemplateModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.account.template was found with criteria %v and options %v", criteria, options) +} diff --git a/account_account_type.go b/account_account_type.go new file mode 100644 index 00000000..fe574dec --- /dev/null +++ b/account_account_type.go @@ -0,0 +1,122 @@ +package odoo + +import ( + "fmt" +) + +// AccountAccountType represents account.account.type model. +type AccountAccountType struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IncludeInitialBalance *Bool `xmlrpc:"include_initial_balance,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Note *String `xmlrpc:"note,omitempty"` + Type *Selection `xmlrpc:"type,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountAccountTypes represents array of account.account.type model. +type AccountAccountTypes []AccountAccountType + +// AccountAccountTypeModel is the odoo model name. +const AccountAccountTypeModel = "account.account.type" + +// Many2One convert AccountAccountType to *Many2One. +func (aat *AccountAccountType) Many2One() *Many2One { + return NewMany2One(aat.Id.Get(), "") +} + +// CreateAccountAccountType creates a new account.account.type model and returns its id. +func (c *Client) CreateAccountAccountType(aat *AccountAccountType) (int64, error) { + return c.Create(AccountAccountTypeModel, aat) +} + +// UpdateAccountAccountType updates an existing account.account.type record. +func (c *Client) UpdateAccountAccountType(aat *AccountAccountType) error { + return c.UpdateAccountAccountTypes([]int64{aat.Id.Get()}, aat) +} + +// UpdateAccountAccountTypes updates existing account.account.type records. +// All records (represented by ids) will be updated by aat values. +func (c *Client) UpdateAccountAccountTypes(ids []int64, aat *AccountAccountType) error { + return c.Update(AccountAccountTypeModel, ids, aat) +} + +// DeleteAccountAccountType deletes an existing account.account.type record. +func (c *Client) DeleteAccountAccountType(id int64) error { + return c.DeleteAccountAccountTypes([]int64{id}) +} + +// DeleteAccountAccountTypes deletes existing account.account.type records. +func (c *Client) DeleteAccountAccountTypes(ids []int64) error { + return c.Delete(AccountAccountTypeModel, ids) +} + +// GetAccountAccountType gets account.account.type existing record. +func (c *Client) GetAccountAccountType(id int64) (*AccountAccountType, error) { + aats, err := c.GetAccountAccountTypes([]int64{id}) + if err != nil { + return nil, err + } + if aats != nil && len(*aats) > 0 { + return &((*aats)[0]), nil + } + return nil, fmt.Errorf("id %v of account.account.type not found", id) +} + +// GetAccountAccountTypes gets account.account.type existing records. +func (c *Client) GetAccountAccountTypes(ids []int64) (*AccountAccountTypes, error) { + aats := &AccountAccountTypes{} + if err := c.Read(AccountAccountTypeModel, ids, nil, aats); err != nil { + return nil, err + } + return aats, nil +} + +// FindAccountAccountType finds account.account.type record by querying it with criteria. +func (c *Client) FindAccountAccountType(criteria *Criteria) (*AccountAccountType, error) { + aats := &AccountAccountTypes{} + if err := c.SearchRead(AccountAccountTypeModel, criteria, NewOptions().Limit(1), aats); err != nil { + return nil, err + } + if aats != nil && len(*aats) > 0 { + return &((*aats)[0]), nil + } + return nil, fmt.Errorf("no account.account.type was found with criteria %v", criteria) +} + +// FindAccountAccountTypes finds account.account.type records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountAccountTypes(criteria *Criteria, options *Options) (*AccountAccountTypes, error) { + aats := &AccountAccountTypes{} + if err := c.SearchRead(AccountAccountTypeModel, criteria, options, aats); err != nil { + return nil, err + } + return aats, nil +} + +// FindAccountAccountTypeIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountAccountTypeIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(AccountAccountTypeModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindAccountAccountTypeId finds record id by querying it with criteria. +func (c *Client) FindAccountAccountTypeId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountAccountTypeModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.account.type was found with criteria %v and options %v", criteria, options) +} diff --git a/account_aged_trial_balance.go b/account_aged_trial_balance.go new file mode 100644 index 00000000..5903bd75 --- /dev/null +++ b/account_aged_trial_balance.go @@ -0,0 +1,125 @@ +package odoo + +import ( + "fmt" +) + +// AccountAgedTrialBalance represents account.aged.trial.balance model. +type AccountAgedTrialBalance struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` + Id *Int `xmlrpc:"id,omitempty"` + JournalIds *Relation `xmlrpc:"journal_ids,omitempty"` + PeriodLength *Int `xmlrpc:"period_length,omitempty"` + ResultSelection *Selection `xmlrpc:"result_selection,omitempty"` + TargetMove *Selection `xmlrpc:"target_move,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountAgedTrialBalances represents array of account.aged.trial.balance model. +type AccountAgedTrialBalances []AccountAgedTrialBalance + +// AccountAgedTrialBalanceModel is the odoo model name. +const AccountAgedTrialBalanceModel = "account.aged.trial.balance" + +// Many2One convert AccountAgedTrialBalance to *Many2One. +func (aatb *AccountAgedTrialBalance) Many2One() *Many2One { + return NewMany2One(aatb.Id.Get(), "") +} + +// CreateAccountAgedTrialBalance creates a new account.aged.trial.balance model and returns its id. +func (c *Client) CreateAccountAgedTrialBalance(aatb *AccountAgedTrialBalance) (int64, error) { + return c.Create(AccountAgedTrialBalanceModel, aatb) +} + +// UpdateAccountAgedTrialBalance updates an existing account.aged.trial.balance record. +func (c *Client) UpdateAccountAgedTrialBalance(aatb *AccountAgedTrialBalance) error { + return c.UpdateAccountAgedTrialBalances([]int64{aatb.Id.Get()}, aatb) +} + +// UpdateAccountAgedTrialBalances updates existing account.aged.trial.balance records. +// All records (represented by ids) will be updated by aatb values. +func (c *Client) UpdateAccountAgedTrialBalances(ids []int64, aatb *AccountAgedTrialBalance) error { + return c.Update(AccountAgedTrialBalanceModel, ids, aatb) +} + +// DeleteAccountAgedTrialBalance deletes an existing account.aged.trial.balance record. +func (c *Client) DeleteAccountAgedTrialBalance(id int64) error { + return c.DeleteAccountAgedTrialBalances([]int64{id}) +} + +// DeleteAccountAgedTrialBalances deletes existing account.aged.trial.balance records. +func (c *Client) DeleteAccountAgedTrialBalances(ids []int64) error { + return c.Delete(AccountAgedTrialBalanceModel, ids) +} + +// GetAccountAgedTrialBalance gets account.aged.trial.balance existing record. +func (c *Client) GetAccountAgedTrialBalance(id int64) (*AccountAgedTrialBalance, error) { + aatbs, err := c.GetAccountAgedTrialBalances([]int64{id}) + if err != nil { + return nil, err + } + if aatbs != nil && len(*aatbs) > 0 { + return &((*aatbs)[0]), nil + } + return nil, fmt.Errorf("id %v of account.aged.trial.balance not found", id) +} + +// GetAccountAgedTrialBalances gets account.aged.trial.balance existing records. +func (c *Client) GetAccountAgedTrialBalances(ids []int64) (*AccountAgedTrialBalances, error) { + aatbs := &AccountAgedTrialBalances{} + if err := c.Read(AccountAgedTrialBalanceModel, ids, nil, aatbs); err != nil { + return nil, err + } + return aatbs, nil +} + +// FindAccountAgedTrialBalance finds account.aged.trial.balance record by querying it with criteria. +func (c *Client) FindAccountAgedTrialBalance(criteria *Criteria) (*AccountAgedTrialBalance, error) { + aatbs := &AccountAgedTrialBalances{} + if err := c.SearchRead(AccountAgedTrialBalanceModel, criteria, NewOptions().Limit(1), aatbs); err != nil { + return nil, err + } + if aatbs != nil && len(*aatbs) > 0 { + return &((*aatbs)[0]), nil + } + return nil, fmt.Errorf("no account.aged.trial.balance was found with criteria %v", criteria) +} + +// FindAccountAgedTrialBalances finds account.aged.trial.balance records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountAgedTrialBalances(criteria *Criteria, options *Options) (*AccountAgedTrialBalances, error) { + aatbs := &AccountAgedTrialBalances{} + if err := c.SearchRead(AccountAgedTrialBalanceModel, criteria, options, aatbs); err != nil { + return nil, err + } + return aatbs, nil +} + +// FindAccountAgedTrialBalanceIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountAgedTrialBalanceIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(AccountAgedTrialBalanceModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindAccountAgedTrialBalanceId finds record id by querying it with criteria. +func (c *Client) FindAccountAgedTrialBalanceId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountAgedTrialBalanceModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.aged.trial.balance was found with criteria %v and options %v", criteria, options) +} diff --git a/account_analytic_account.go b/account_analytic_account.go index 864ef6cb..1279c207 100644 --- a/account_analytic_account.go +++ b/account_analytic_account.go @@ -6,40 +6,40 @@ import ( // AccountAnalyticAccount represents account.analytic.account model. type AccountAnalyticAccount struct { - LastUpdate *Time `xmlrpc:"__last_update,omptempty"` - Active *Bool `xmlrpc:"active,omptempty"` - Balance *Float `xmlrpc:"balance,omptempty"` - Code *String `xmlrpc:"code,omptempty"` - CompanyId *Many2One `xmlrpc:"company_id,omptempty"` - CompanyUomId *Many2One `xmlrpc:"company_uom_id,omptempty"` - CreateDate *Time `xmlrpc:"create_date,omptempty"` - CreateUid *Many2One `xmlrpc:"create_uid,omptempty"` - Credit *Float `xmlrpc:"credit,omptempty"` - CurrencyId *Many2One `xmlrpc:"currency_id,omptempty"` - Debit *Float `xmlrpc:"debit,omptempty"` - DisplayName *String `xmlrpc:"display_name,omptempty"` - Id *Int `xmlrpc:"id,omptempty"` - LineIds *Relation `xmlrpc:"line_ids,omptempty"` - MachineProjectName *String `xmlrpc:"machine_project_name,omptempty"` - MessageChannelIds *Relation `xmlrpc:"message_channel_ids,omptempty"` - MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omptempty"` - MessageIds *Relation `xmlrpc:"message_ids,omptempty"` - MessageIsFollower *Bool `xmlrpc:"message_is_follower,omptempty"` - MessageLastPost *Time `xmlrpc:"message_last_post,omptempty"` - MessageNeedaction *Bool `xmlrpc:"message_needaction,omptempty"` - MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omptempty"` - MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omptempty"` - MessageUnread *Bool `xmlrpc:"message_unread,omptempty"` - MessageUnreadCounter *Int `xmlrpc:"message_unread_counter,omptempty"` - Name *String `xmlrpc:"name,omptempty"` - PartnerId *Many2One `xmlrpc:"partner_id,omptempty"` - ProjectCount *Int `xmlrpc:"project_count,omptempty"` - ProjectCreated *Bool `xmlrpc:"project_created,omptempty"` - ProjectIds *Relation `xmlrpc:"project_ids,omptempty"` - TagIds *Relation `xmlrpc:"tag_ids,omptempty"` - WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omptempty"` - WriteDate *Time `xmlrpc:"write_date,omptempty"` - WriteUid *Many2One `xmlrpc:"write_uid,omptempty"` + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + Active *Bool `xmlrpc:"active,omitempty"` + Balance *Float `xmlrpc:"balance,omitempty"` + Code *String `xmlrpc:"code,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CompanyUomId *Many2One `xmlrpc:"company_uom_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"` + Id *Int `xmlrpc:"id,omitempty"` + LineIds *Relation `xmlrpc:"line_ids,omitempty"` + MachineProjectName *String `xmlrpc:"machine_project_name,omitempty"` + MessageChannelIds *Relation `xmlrpc:"message_channel_ids,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageLastPost *Time `xmlrpc:"message_last_post,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MessageUnread *Bool `xmlrpc:"message_unread,omitempty"` + MessageUnreadCounter *Int `xmlrpc:"message_unread_counter,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + ProjectCount *Int `xmlrpc:"project_count,omitempty"` + ProjectCreated *Bool `xmlrpc:"project_created,omitempty"` + ProjectIds *Relation `xmlrpc:"project_ids,omitempty"` + TagIds *Relation `xmlrpc:"tag_ids,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. @@ -109,7 +109,7 @@ func (c *Client) FindAccountAnalyticAccount(criteria *Criteria) (*AccountAnalyti if aaas != nil && len(*aaas) > 0 { return &((*aaas)[0]), nil } - return nil, fmt.Errorf("account.analytic.account was not found") + return nil, fmt.Errorf("no account.analytic.account was found with criteria %v", criteria) } // FindAccountAnalyticAccounts finds account.analytic.account records by querying it @@ -141,5 +141,5 @@ func (c *Client) FindAccountAnalyticAccountId(criteria *Criteria, options *Optio if len(ids) > 0 { return ids[0], nil } - return -1, fmt.Errorf("account.analytic.account was not found") + return -1, fmt.Errorf("no account.analytic.account was found with criteria %v and options %v", criteria, options) } diff --git a/account_analytic_line.go b/account_analytic_line.go index 1a74d301..b7039cf6 100644 --- a/account_analytic_line.go +++ b/account_analytic_line.go @@ -6,41 +6,41 @@ import ( // AccountAnalyticLine represents account.analytic.line model. type AccountAnalyticLine struct { - LastUpdate *Time `xmlrpc:"__last_update,omptempty"` - AccountId *Many2One `xmlrpc:"account_id,omptempty"` - Amount *Float `xmlrpc:"amount,omptempty"` - AmountCurrency *Float `xmlrpc:"amount_currency,omptempty"` - AnalyticAmountCurrency *Float `xmlrpc:"analytic_amount_currency,omptempty"` - Code *String `xmlrpc:"code,omptempty"` - CompanyCurrencyId *Many2One `xmlrpc:"company_currency_id,omptempty"` - CompanyId *Many2One `xmlrpc:"company_id,omptempty"` - CreateDate *Time `xmlrpc:"create_date,omptempty"` - CreateUid *Many2One `xmlrpc:"create_uid,omptempty"` - CurrencyId *Many2One `xmlrpc:"currency_id,omptempty"` - Date *Time `xmlrpc:"date,omptempty"` - DepartmentId *Many2One `xmlrpc:"department_id,omptempty"` - DisplayName *String `xmlrpc:"display_name,omptempty"` - EmployeeId *Many2One `xmlrpc:"employee_id,omptempty"` - GeneralAccountId *Many2One `xmlrpc:"general_account_id,omptempty"` - HolidayId *Many2One `xmlrpc:"holiday_id,omptempty"` - Id *Int `xmlrpc:"id,omptempty"` - MoveId *Many2One `xmlrpc:"move_id,omptempty"` - Name *String `xmlrpc:"name,omptempty"` - PartnerId *Many2One `xmlrpc:"partner_id,omptempty"` - ProductId *Many2One `xmlrpc:"product_id,omptempty"` - ProductUomId *Many2One `xmlrpc:"product_uom_id,omptempty"` - ProjectId *Many2One `xmlrpc:"project_id,omptempty"` - Ref *String `xmlrpc:"ref,omptempty"` - SoLine *Many2One `xmlrpc:"so_line,omptempty"` - TagIds *Relation `xmlrpc:"tag_ids,omptempty"` - TaskId *Many2One `xmlrpc:"task_id,omptempty"` - TimesheetInvoiceId *Many2One `xmlrpc:"timesheet_invoice_id,omptempty"` - TimesheetInvoiceType *Selection `xmlrpc:"timesheet_invoice_type,omptempty"` - TimesheetRevenue *Float `xmlrpc:"timesheet_revenue,omptempty"` - UnitAmount *Float `xmlrpc:"unit_amount,omptempty"` - UserId *Many2One `xmlrpc:"user_id,omptempty"` - WriteDate *Time `xmlrpc:"write_date,omptempty"` - WriteUid *Many2One `xmlrpc:"write_uid,omptempty"` + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AccountId *Many2One `xmlrpc:"account_id,omitempty"` + Amount *Float `xmlrpc:"amount,omitempty"` + AmountCurrency *Float `xmlrpc:"amount_currency,omitempty"` + AnalyticAmountCurrency *Float `xmlrpc:"analytic_amount_currency,omitempty"` + Code *String `xmlrpc:"code,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"` + Date *Time `xmlrpc:"date,omitempty"` + DepartmentId *Many2One `xmlrpc:"department_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + EmployeeId *Many2One `xmlrpc:"employee_id,omitempty"` + GeneralAccountId *Many2One `xmlrpc:"general_account_id,omitempty"` + HolidayId *Many2One `xmlrpc:"holiday_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + MoveId *Many2One `xmlrpc:"move_id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + ProductId *Many2One `xmlrpc:"product_id,omitempty"` + ProductUomId *Many2One `xmlrpc:"product_uom_id,omitempty"` + ProjectId *Many2One `xmlrpc:"project_id,omitempty"` + Ref *String `xmlrpc:"ref,omitempty"` + SoLine *Many2One `xmlrpc:"so_line,omitempty"` + TagIds *Relation `xmlrpc:"tag_ids,omitempty"` + TaskId *Many2One `xmlrpc:"task_id,omitempty"` + TimesheetInvoiceId *Many2One `xmlrpc:"timesheet_invoice_id,omitempty"` + TimesheetInvoiceType *Selection `xmlrpc:"timesheet_invoice_type,omitempty"` + TimesheetRevenue *Float `xmlrpc:"timesheet_revenue,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. @@ -110,7 +110,7 @@ func (c *Client) FindAccountAnalyticLine(criteria *Criteria) (*AccountAnalyticLi if aals != nil && len(*aals) > 0 { return &((*aals)[0]), nil } - return nil, fmt.Errorf("account.analytic.line was not found") + return nil, fmt.Errorf("no account.analytic.line was found with criteria %v", criteria) } // FindAccountAnalyticLines finds account.analytic.line records by querying it @@ -142,5 +142,5 @@ func (c *Client) FindAccountAnalyticLineId(criteria *Criteria, options *Options) if len(ids) > 0 { return ids[0], nil } - return -1, fmt.Errorf("account.analytic.line was not found") + return -1, fmt.Errorf("no account.analytic.line was found with criteria %v and options %v", criteria, options) } diff --git a/account_analytic_tag.go b/account_analytic_tag.go index efb10109..511d6f9f 100644 --- a/account_analytic_tag.go +++ b/account_analytic_tag.go @@ -6,16 +6,16 @@ import ( // AccountAnalyticTag represents account.analytic.tag model. type AccountAnalyticTag struct { - LastUpdate *Time `xmlrpc:"__last_update,omptempty"` - Active *Bool `xmlrpc:"active,omptempty"` - Color *Int `xmlrpc:"color,omptempty"` - CreateDate *Time `xmlrpc:"create_date,omptempty"` - CreateUid *Many2One `xmlrpc:"create_uid,omptempty"` - DisplayName *String `xmlrpc:"display_name,omptempty"` - Id *Int `xmlrpc:"id,omptempty"` - Name *String `xmlrpc:"name,omptempty"` - WriteDate *Time `xmlrpc:"write_date,omptempty"` - WriteUid *Many2One `xmlrpc:"write_uid,omptempty"` + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` } // AccountAnalyticTags represents array of account.analytic.tag model. @@ -85,7 +85,7 @@ func (c *Client) FindAccountAnalyticTag(criteria *Criteria) (*AccountAnalyticTag if aats != nil && len(*aats) > 0 { return &((*aats)[0]), nil } - return nil, fmt.Errorf("account.analytic.tag was not found") + return nil, fmt.Errorf("no account.analytic.tag was found with criteria %v", criteria) } // FindAccountAnalyticTags finds account.analytic.tag records by querying it @@ -117,5 +117,5 @@ func (c *Client) FindAccountAnalyticTagId(criteria *Criteria, options *Options) if len(ids) > 0 { return ids[0], nil } - return -1, fmt.Errorf("account.analytic.tag was not found") + return -1, fmt.Errorf("no account.analytic.tag was found with criteria %v and options %v", criteria, options) } diff --git a/account_balance_report.go b/account_balance_report.go new file mode 100644 index 00000000..4f00123e --- /dev/null +++ b/account_balance_report.go @@ -0,0 +1,124 @@ +package odoo + +import ( + "fmt" +) + +// AccountBalanceReport represents account.balance.report model. +type AccountBalanceReport struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` + DisplayAccount *Selection `xmlrpc:"display_account,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + JournalIds *Relation `xmlrpc:"journal_ids,omitempty"` + TargetMove *Selection `xmlrpc:"target_move,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountBalanceReports represents array of account.balance.report model. +type AccountBalanceReports []AccountBalanceReport + +// AccountBalanceReportModel is the odoo model name. +const AccountBalanceReportModel = "account.balance.report" + +// Many2One convert AccountBalanceReport to *Many2One. +func (abr *AccountBalanceReport) Many2One() *Many2One { + return NewMany2One(abr.Id.Get(), "") +} + +// CreateAccountBalanceReport creates a new account.balance.report model and returns its id. +func (c *Client) CreateAccountBalanceReport(abr *AccountBalanceReport) (int64, error) { + return c.Create(AccountBalanceReportModel, abr) +} + +// UpdateAccountBalanceReport updates an existing account.balance.report record. +func (c *Client) UpdateAccountBalanceReport(abr *AccountBalanceReport) error { + return c.UpdateAccountBalanceReports([]int64{abr.Id.Get()}, abr) +} + +// UpdateAccountBalanceReports updates existing account.balance.report records. +// All records (represented by ids) will be updated by abr values. +func (c *Client) UpdateAccountBalanceReports(ids []int64, abr *AccountBalanceReport) error { + return c.Update(AccountBalanceReportModel, ids, abr) +} + +// DeleteAccountBalanceReport deletes an existing account.balance.report record. +func (c *Client) DeleteAccountBalanceReport(id int64) error { + return c.DeleteAccountBalanceReports([]int64{id}) +} + +// DeleteAccountBalanceReports deletes existing account.balance.report records. +func (c *Client) DeleteAccountBalanceReports(ids []int64) error { + return c.Delete(AccountBalanceReportModel, ids) +} + +// GetAccountBalanceReport gets account.balance.report existing record. +func (c *Client) GetAccountBalanceReport(id int64) (*AccountBalanceReport, error) { + abrs, err := c.GetAccountBalanceReports([]int64{id}) + if err != nil { + return nil, err + } + if abrs != nil && len(*abrs) > 0 { + return &((*abrs)[0]), nil + } + return nil, fmt.Errorf("id %v of account.balance.report not found", id) +} + +// GetAccountBalanceReports gets account.balance.report existing records. +func (c *Client) GetAccountBalanceReports(ids []int64) (*AccountBalanceReports, error) { + abrs := &AccountBalanceReports{} + if err := c.Read(AccountBalanceReportModel, ids, nil, abrs); err != nil { + return nil, err + } + return abrs, nil +} + +// FindAccountBalanceReport finds account.balance.report record by querying it with criteria. +func (c *Client) FindAccountBalanceReport(criteria *Criteria) (*AccountBalanceReport, error) { + abrs := &AccountBalanceReports{} + if err := c.SearchRead(AccountBalanceReportModel, criteria, NewOptions().Limit(1), abrs); err != nil { + return nil, err + } + if abrs != nil && len(*abrs) > 0 { + return &((*abrs)[0]), nil + } + return nil, fmt.Errorf("no account.balance.report was found with criteria %v", criteria) +} + +// FindAccountBalanceReports finds account.balance.report records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountBalanceReports(criteria *Criteria, options *Options) (*AccountBalanceReports, error) { + abrs := &AccountBalanceReports{} + if err := c.SearchRead(AccountBalanceReportModel, criteria, options, abrs); err != nil { + return nil, err + } + return abrs, nil +} + +// FindAccountBalanceReportIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountBalanceReportIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(AccountBalanceReportModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindAccountBalanceReportId finds record id by querying it with criteria. +func (c *Client) FindAccountBalanceReportId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountBalanceReportModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.balance.report was found with criteria %v and options %v", criteria, options) +} diff --git a/account_bank_accounts_wizard.go b/account_bank_accounts_wizard.go new file mode 100644 index 00000000..7760a55f --- /dev/null +++ b/account_bank_accounts_wizard.go @@ -0,0 +1,122 @@ +package odoo + +import ( + "fmt" +) + +// AccountBankAccountsWizard represents account.bank.accounts.wizard model. +type AccountBankAccountsWizard struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AccName *String `xmlrpc:"acc_name,omitempty"` + AccountType *Selection `xmlrpc:"account_type,omitempty"` + BankAccountId *Many2One `xmlrpc:"bank_account_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"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountBankAccountsWizards represents array of account.bank.accounts.wizard model. +type AccountBankAccountsWizards []AccountBankAccountsWizard + +// AccountBankAccountsWizardModel is the odoo model name. +const AccountBankAccountsWizardModel = "account.bank.accounts.wizard" + +// Many2One convert AccountBankAccountsWizard to *Many2One. +func (abaw *AccountBankAccountsWizard) Many2One() *Many2One { + return NewMany2One(abaw.Id.Get(), "") +} + +// CreateAccountBankAccountsWizard creates a new account.bank.accounts.wizard model and returns its id. +func (c *Client) CreateAccountBankAccountsWizard(abaw *AccountBankAccountsWizard) (int64, error) { + return c.Create(AccountBankAccountsWizardModel, abaw) +} + +// UpdateAccountBankAccountsWizard updates an existing account.bank.accounts.wizard record. +func (c *Client) UpdateAccountBankAccountsWizard(abaw *AccountBankAccountsWizard) error { + return c.UpdateAccountBankAccountsWizards([]int64{abaw.Id.Get()}, abaw) +} + +// UpdateAccountBankAccountsWizards updates existing account.bank.accounts.wizard records. +// All records (represented by ids) will be updated by abaw values. +func (c *Client) UpdateAccountBankAccountsWizards(ids []int64, abaw *AccountBankAccountsWizard) error { + return c.Update(AccountBankAccountsWizardModel, ids, abaw) +} + +// DeleteAccountBankAccountsWizard deletes an existing account.bank.accounts.wizard record. +func (c *Client) DeleteAccountBankAccountsWizard(id int64) error { + return c.DeleteAccountBankAccountsWizards([]int64{id}) +} + +// DeleteAccountBankAccountsWizards deletes existing account.bank.accounts.wizard records. +func (c *Client) DeleteAccountBankAccountsWizards(ids []int64) error { + return c.Delete(AccountBankAccountsWizardModel, ids) +} + +// GetAccountBankAccountsWizard gets account.bank.accounts.wizard existing record. +func (c *Client) GetAccountBankAccountsWizard(id int64) (*AccountBankAccountsWizard, error) { + abaws, err := c.GetAccountBankAccountsWizards([]int64{id}) + if err != nil { + return nil, err + } + if abaws != nil && len(*abaws) > 0 { + return &((*abaws)[0]), nil + } + return nil, fmt.Errorf("id %v of account.bank.accounts.wizard not found", id) +} + +// GetAccountBankAccountsWizards gets account.bank.accounts.wizard existing records. +func (c *Client) GetAccountBankAccountsWizards(ids []int64) (*AccountBankAccountsWizards, error) { + abaws := &AccountBankAccountsWizards{} + if err := c.Read(AccountBankAccountsWizardModel, ids, nil, abaws); err != nil { + return nil, err + } + return abaws, nil +} + +// FindAccountBankAccountsWizard finds account.bank.accounts.wizard record by querying it with criteria. +func (c *Client) FindAccountBankAccountsWizard(criteria *Criteria) (*AccountBankAccountsWizard, error) { + abaws := &AccountBankAccountsWizards{} + if err := c.SearchRead(AccountBankAccountsWizardModel, criteria, NewOptions().Limit(1), abaws); err != nil { + return nil, err + } + if abaws != nil && len(*abaws) > 0 { + return &((*abaws)[0]), nil + } + return nil, fmt.Errorf("no account.bank.accounts.wizard was found with criteria %v", criteria) +} + +// FindAccountBankAccountsWizards finds account.bank.accounts.wizard records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountBankAccountsWizards(criteria *Criteria, options *Options) (*AccountBankAccountsWizards, error) { + abaws := &AccountBankAccountsWizards{} + if err := c.SearchRead(AccountBankAccountsWizardModel, criteria, options, abaws); err != nil { + return nil, err + } + return abaws, nil +} + +// FindAccountBankAccountsWizardIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountBankAccountsWizardIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(AccountBankAccountsWizardModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindAccountBankAccountsWizardId finds record id by querying it with criteria. +func (c *Client) FindAccountBankAccountsWizardId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountBankAccountsWizardModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.bank.accounts.wizard was found with criteria %v and options %v", criteria, options) +} diff --git a/account_bank_statement.go b/account_bank_statement.go new file mode 100644 index 00000000..4aa725fa --- /dev/null +++ b/account_bank_statement.go @@ -0,0 +1,151 @@ +package odoo + +import ( + "fmt" +) + +// AccountBankStatement represents account.bank.statement model. +type AccountBankStatement struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AllLinesReconciled *Bool `xmlrpc:"all_lines_reconciled,omitempty"` + BalanceEnd *Float `xmlrpc:"balance_end,omitempty"` + BalanceEndReal *Float `xmlrpc:"balance_end_real,omitempty"` + BalanceStart *Float `xmlrpc:"balance_start,omitempty"` + CashboxEndId *Many2One `xmlrpc:"cashbox_end_id,omitempty"` + CashboxStartId *Many2One `xmlrpc:"cashbox_start_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"` + DateDone *Time `xmlrpc:"date_done,omitempty"` + Difference *Float `xmlrpc:"difference,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsDifferenceZero *Bool `xmlrpc:"is_difference_zero,omitempty"` + JournalId *Many2One `xmlrpc:"journal_id,omitempty"` + JournalType *Selection `xmlrpc:"journal_type,omitempty"` + LineIds *Relation `xmlrpc:"line_ids,omitempty"` + MessageChannelIds *Relation `xmlrpc:"message_channel_ids,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageLastPost *Time `xmlrpc:"message_last_post,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MessageUnread *Bool `xmlrpc:"message_unread,omitempty"` + MessageUnreadCounter *Int `xmlrpc:"message_unread_counter,omitempty"` + MoveLineCount *Int `xmlrpc:"move_line_count,omitempty"` + MoveLineIds *Relation `xmlrpc:"move_line_ids,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Reference *String `xmlrpc:"reference,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + TotalEntryEncoding *Float `xmlrpc:"total_entry_encoding,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"` +} + +// 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) { + return c.Create(AccountBankStatementModel, abs) +} + +// 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) +} + +// 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 + } + if abss != nil && len(*abss) > 0 { + return &((*abss)[0]), nil + } + return nil, fmt.Errorf("id %v of account.bank.statement not found", id) +} + +// 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 + } + if abss != nil && len(*abss) > 0 { + return &((*abss)[0]), nil + } + return nil, fmt.Errorf("no account.bank.statement was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(AccountBankStatementModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.bank.statement was found with criteria %v and options %v", criteria, options) +} diff --git a/account_bank_statement_cashbox.go b/account_bank_statement_cashbox.go new file mode 100644 index 00000000..e3a325ee --- /dev/null +++ b/account_bank_statement_cashbox.go @@ -0,0 +1,119 @@ +package odoo + +import ( + "fmt" +) + +// AccountBankStatementCashbox represents account.bank.statement.cashbox model. +type AccountBankStatementCashbox struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CashboxLinesIds *Relation `xmlrpc:"cashbox_lines_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"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountBankStatementCashboxs represents array of account.bank.statement.cashbox model. +type AccountBankStatementCashboxs []AccountBankStatementCashbox + +// AccountBankStatementCashboxModel is the odoo model name. +const AccountBankStatementCashboxModel = "account.bank.statement.cashbox" + +// Many2One convert AccountBankStatementCashbox to *Many2One. +func (absc *AccountBankStatementCashbox) Many2One() *Many2One { + return NewMany2One(absc.Id.Get(), "") +} + +// CreateAccountBankStatementCashbox creates a new account.bank.statement.cashbox model and returns its id. +func (c *Client) CreateAccountBankStatementCashbox(absc *AccountBankStatementCashbox) (int64, error) { + return c.Create(AccountBankStatementCashboxModel, absc) +} + +// UpdateAccountBankStatementCashbox updates an existing account.bank.statement.cashbox record. +func (c *Client) UpdateAccountBankStatementCashbox(absc *AccountBankStatementCashbox) error { + return c.UpdateAccountBankStatementCashboxs([]int64{absc.Id.Get()}, absc) +} + +// UpdateAccountBankStatementCashboxs updates existing account.bank.statement.cashbox records. +// All records (represented by ids) will be updated by absc values. +func (c *Client) UpdateAccountBankStatementCashboxs(ids []int64, absc *AccountBankStatementCashbox) error { + return c.Update(AccountBankStatementCashboxModel, ids, absc) +} + +// DeleteAccountBankStatementCashbox deletes an existing account.bank.statement.cashbox record. +func (c *Client) DeleteAccountBankStatementCashbox(id int64) error { + return c.DeleteAccountBankStatementCashboxs([]int64{id}) +} + +// DeleteAccountBankStatementCashboxs deletes existing account.bank.statement.cashbox records. +func (c *Client) DeleteAccountBankStatementCashboxs(ids []int64) error { + return c.Delete(AccountBankStatementCashboxModel, ids) +} + +// GetAccountBankStatementCashbox gets account.bank.statement.cashbox existing record. +func (c *Client) GetAccountBankStatementCashbox(id int64) (*AccountBankStatementCashbox, error) { + abscs, err := c.GetAccountBankStatementCashboxs([]int64{id}) + if err != nil { + return nil, err + } + if abscs != nil && len(*abscs) > 0 { + return &((*abscs)[0]), nil + } + return nil, fmt.Errorf("id %v of account.bank.statement.cashbox not found", id) +} + +// GetAccountBankStatementCashboxs gets account.bank.statement.cashbox existing records. +func (c *Client) GetAccountBankStatementCashboxs(ids []int64) (*AccountBankStatementCashboxs, error) { + abscs := &AccountBankStatementCashboxs{} + if err := c.Read(AccountBankStatementCashboxModel, ids, nil, abscs); err != nil { + return nil, err + } + return abscs, nil +} + +// FindAccountBankStatementCashbox finds account.bank.statement.cashbox record by querying it with criteria. +func (c *Client) FindAccountBankStatementCashbox(criteria *Criteria) (*AccountBankStatementCashbox, error) { + abscs := &AccountBankStatementCashboxs{} + if err := c.SearchRead(AccountBankStatementCashboxModel, criteria, NewOptions().Limit(1), abscs); err != nil { + return nil, err + } + if abscs != nil && len(*abscs) > 0 { + return &((*abscs)[0]), nil + } + return nil, fmt.Errorf("no account.bank.statement.cashbox was found with criteria %v", criteria) +} + +// FindAccountBankStatementCashboxs finds account.bank.statement.cashbox records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountBankStatementCashboxs(criteria *Criteria, options *Options) (*AccountBankStatementCashboxs, error) { + abscs := &AccountBankStatementCashboxs{} + if err := c.SearchRead(AccountBankStatementCashboxModel, criteria, options, abscs); err != nil { + return nil, err + } + return abscs, nil +} + +// FindAccountBankStatementCashboxIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountBankStatementCashboxIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(AccountBankStatementCashboxModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindAccountBankStatementCashboxId finds record id by querying it with criteria. +func (c *Client) FindAccountBankStatementCashboxId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountBankStatementCashboxModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.bank.statement.cashbox was found with criteria %v and options %v", criteria, options) +} diff --git a/account_bank_statement_closebalance.go b/account_bank_statement_closebalance.go new file mode 100644 index 00000000..14e6d81c --- /dev/null +++ b/account_bank_statement_closebalance.go @@ -0,0 +1,118 @@ +package odoo + +import ( + "fmt" +) + +// AccountBankStatementClosebalance represents account.bank.statement.closebalance model. +type AccountBankStatementClosebalance struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` +} + +// AccountBankStatementClosebalances represents array of account.bank.statement.closebalance model. +type AccountBankStatementClosebalances []AccountBankStatementClosebalance + +// AccountBankStatementClosebalanceModel is the odoo model name. +const AccountBankStatementClosebalanceModel = "account.bank.statement.closebalance" + +// Many2One convert AccountBankStatementClosebalance to *Many2One. +func (absc *AccountBankStatementClosebalance) Many2One() *Many2One { + return NewMany2One(absc.Id.Get(), "") +} + +// CreateAccountBankStatementClosebalance creates a new account.bank.statement.closebalance model and returns its id. +func (c *Client) CreateAccountBankStatementClosebalance(absc *AccountBankStatementClosebalance) (int64, error) { + return c.Create(AccountBankStatementClosebalanceModel, absc) +} + +// UpdateAccountBankStatementClosebalance updates an existing account.bank.statement.closebalance record. +func (c *Client) UpdateAccountBankStatementClosebalance(absc *AccountBankStatementClosebalance) error { + return c.UpdateAccountBankStatementClosebalances([]int64{absc.Id.Get()}, absc) +} + +// UpdateAccountBankStatementClosebalances updates existing account.bank.statement.closebalance records. +// All records (represented by ids) will be updated by absc values. +func (c *Client) UpdateAccountBankStatementClosebalances(ids []int64, absc *AccountBankStatementClosebalance) error { + return c.Update(AccountBankStatementClosebalanceModel, ids, absc) +} + +// DeleteAccountBankStatementClosebalance deletes an existing account.bank.statement.closebalance record. +func (c *Client) DeleteAccountBankStatementClosebalance(id int64) error { + return c.DeleteAccountBankStatementClosebalances([]int64{id}) +} + +// DeleteAccountBankStatementClosebalances deletes existing account.bank.statement.closebalance records. +func (c *Client) DeleteAccountBankStatementClosebalances(ids []int64) error { + return c.Delete(AccountBankStatementClosebalanceModel, ids) +} + +// GetAccountBankStatementClosebalance gets account.bank.statement.closebalance existing record. +func (c *Client) GetAccountBankStatementClosebalance(id int64) (*AccountBankStatementClosebalance, error) { + abscs, err := c.GetAccountBankStatementClosebalances([]int64{id}) + if err != nil { + return nil, err + } + if abscs != nil && len(*abscs) > 0 { + return &((*abscs)[0]), nil + } + return nil, fmt.Errorf("id %v of account.bank.statement.closebalance not found", id) +} + +// GetAccountBankStatementClosebalances gets account.bank.statement.closebalance existing records. +func (c *Client) GetAccountBankStatementClosebalances(ids []int64) (*AccountBankStatementClosebalances, error) { + abscs := &AccountBankStatementClosebalances{} + if err := c.Read(AccountBankStatementClosebalanceModel, ids, nil, abscs); err != nil { + return nil, err + } + return abscs, nil +} + +// FindAccountBankStatementClosebalance finds account.bank.statement.closebalance record by querying it with criteria. +func (c *Client) FindAccountBankStatementClosebalance(criteria *Criteria) (*AccountBankStatementClosebalance, error) { + abscs := &AccountBankStatementClosebalances{} + if err := c.SearchRead(AccountBankStatementClosebalanceModel, criteria, NewOptions().Limit(1), abscs); err != nil { + return nil, err + } + if abscs != nil && len(*abscs) > 0 { + return &((*abscs)[0]), nil + } + return nil, fmt.Errorf("no account.bank.statement.closebalance was found with criteria %v", criteria) +} + +// FindAccountBankStatementClosebalances finds account.bank.statement.closebalance records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountBankStatementClosebalances(criteria *Criteria, options *Options) (*AccountBankStatementClosebalances, error) { + abscs := &AccountBankStatementClosebalances{} + if err := c.SearchRead(AccountBankStatementClosebalanceModel, criteria, options, abscs); err != nil { + return nil, err + } + return abscs, nil +} + +// FindAccountBankStatementClosebalanceIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountBankStatementClosebalanceIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(AccountBankStatementClosebalanceModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindAccountBankStatementClosebalanceId finds record id by querying it with criteria. +func (c *Client) FindAccountBankStatementClosebalanceId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountBankStatementClosebalanceModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.bank.statement.closebalance was found with criteria %v and options %v", criteria, options) +} diff --git a/account_bank_statement_import.go b/account_bank_statement_import.go new file mode 100644 index 00000000..d8ecd37a --- /dev/null +++ b/account_bank_statement_import.go @@ -0,0 +1,120 @@ +package odoo + +import ( + "fmt" +) + +// AccountBankStatementImport represents account.bank.statement.import model. +type AccountBankStatementImport struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DataFile *String `xmlrpc:"data_file,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Filename *String `xmlrpc:"filename,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountBankStatementImports represents array of account.bank.statement.import model. +type AccountBankStatementImports []AccountBankStatementImport + +// AccountBankStatementImportModel is the odoo model name. +const AccountBankStatementImportModel = "account.bank.statement.import" + +// Many2One convert AccountBankStatementImport to *Many2One. +func (absi *AccountBankStatementImport) Many2One() *Many2One { + return NewMany2One(absi.Id.Get(), "") +} + +// CreateAccountBankStatementImport creates a new account.bank.statement.import model and returns its id. +func (c *Client) CreateAccountBankStatementImport(absi *AccountBankStatementImport) (int64, error) { + return c.Create(AccountBankStatementImportModel, absi) +} + +// UpdateAccountBankStatementImport updates an existing account.bank.statement.import record. +func (c *Client) UpdateAccountBankStatementImport(absi *AccountBankStatementImport) error { + return c.UpdateAccountBankStatementImports([]int64{absi.Id.Get()}, absi) +} + +// UpdateAccountBankStatementImports updates existing account.bank.statement.import records. +// All records (represented by ids) will be updated by absi values. +func (c *Client) UpdateAccountBankStatementImports(ids []int64, absi *AccountBankStatementImport) error { + return c.Update(AccountBankStatementImportModel, ids, absi) +} + +// DeleteAccountBankStatementImport deletes an existing account.bank.statement.import record. +func (c *Client) DeleteAccountBankStatementImport(id int64) error { + return c.DeleteAccountBankStatementImports([]int64{id}) +} + +// DeleteAccountBankStatementImports deletes existing account.bank.statement.import records. +func (c *Client) DeleteAccountBankStatementImports(ids []int64) error { + return c.Delete(AccountBankStatementImportModel, ids) +} + +// GetAccountBankStatementImport gets account.bank.statement.import existing record. +func (c *Client) GetAccountBankStatementImport(id int64) (*AccountBankStatementImport, error) { + absis, err := c.GetAccountBankStatementImports([]int64{id}) + if err != nil { + return nil, err + } + if absis != nil && len(*absis) > 0 { + return &((*absis)[0]), nil + } + return nil, fmt.Errorf("id %v of account.bank.statement.import not found", id) +} + +// GetAccountBankStatementImports gets account.bank.statement.import existing records. +func (c *Client) GetAccountBankStatementImports(ids []int64) (*AccountBankStatementImports, error) { + absis := &AccountBankStatementImports{} + if err := c.Read(AccountBankStatementImportModel, ids, nil, absis); err != nil { + return nil, err + } + return absis, nil +} + +// FindAccountBankStatementImport finds account.bank.statement.import record by querying it with criteria. +func (c *Client) FindAccountBankStatementImport(criteria *Criteria) (*AccountBankStatementImport, error) { + absis := &AccountBankStatementImports{} + if err := c.SearchRead(AccountBankStatementImportModel, criteria, NewOptions().Limit(1), absis); err != nil { + return nil, err + } + if absis != nil && len(*absis) > 0 { + return &((*absis)[0]), nil + } + return nil, fmt.Errorf("no account.bank.statement.import was found with criteria %v", criteria) +} + +// FindAccountBankStatementImports finds account.bank.statement.import records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountBankStatementImports(criteria *Criteria, options *Options) (*AccountBankStatementImports, error) { + absis := &AccountBankStatementImports{} + if err := c.SearchRead(AccountBankStatementImportModel, criteria, options, absis); err != nil { + return nil, err + } + return absis, nil +} + +// FindAccountBankStatementImportIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountBankStatementImportIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(AccountBankStatementImportModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindAccountBankStatementImportId finds record id by querying it with criteria. +func (c *Client) FindAccountBankStatementImportId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountBankStatementImportModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.bank.statement.import was found with criteria %v and options %v", criteria, options) +} diff --git a/account_bank_statement_import_journal_creation.go b/account_bank_statement_import_journal_creation.go new file mode 100644 index 00000000..42cf90a1 --- /dev/null +++ b/account_bank_statement_import_journal_creation.go @@ -0,0 +1,153 @@ +package odoo + +import ( + "fmt" +) + +// AccountBankStatementImportJournalCreation represents account.bank.statement.import.journal.creation model. +type AccountBankStatementImportJournalCreation struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AccountControlIds *Relation `xmlrpc:"account_control_ids,omitempty"` + AccountSetupBankDataDone *Bool `xmlrpc:"account_setup_bank_data_done,omitempty"` + Active *Bool `xmlrpc:"active,omitempty"` + AtLeastOneInbound *Bool `xmlrpc:"at_least_one_inbound,omitempty"` + AtLeastOneOutbound *Bool `xmlrpc:"at_least_one_outbound,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"` + BelongsToCompany *Bool `xmlrpc:"belongs_to_company,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"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + DefaultCreditAccountId *Many2One `xmlrpc:"default_credit_account_id,omitempty"` + DefaultDebitAccountId *Many2One `xmlrpc:"default_debit_account_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + GroupInvoiceLines *Bool `xmlrpc:"group_invoice_lines,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + InboundPaymentMethodIds *Relation `xmlrpc:"inbound_payment_method_ids,omitempty"` + JournalId *Many2One `xmlrpc:"journal_id,omitempty"` + KanbanDashboard *String `xmlrpc:"kanban_dashboard,omitempty"` + KanbanDashboardGraph *String `xmlrpc:"kanban_dashboard_graph,omitempty"` + LossAccountId *Many2One `xmlrpc:"loss_account_id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + OutboundPaymentMethodIds *Relation `xmlrpc:"outbound_payment_method_ids,omitempty"` + ProfitAccountId *Many2One `xmlrpc:"profit_account_id,omitempty"` + RefundSequence *Bool `xmlrpc:"refund_sequence,omitempty"` + RefundSequenceId *Many2One `xmlrpc:"refund_sequence_id,omitempty"` + RefundSequenceNumberNext *Int `xmlrpc:"refund_sequence_number_next,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + SequenceId *Many2One `xmlrpc:"sequence_id,omitempty"` + SequenceNumberNext *Int `xmlrpc:"sequence_number_next,omitempty"` + ShowOnDashboard *Bool `xmlrpc:"show_on_dashboard,omitempty"` + Type *Selection `xmlrpc:"type,omitempty"` + TypeControlIds *Relation `xmlrpc:"type_control_ids,omitempty"` + UpdatePosted *Bool `xmlrpc:"update_posted,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountBankStatementImportJournalCreations represents array of account.bank.statement.import.journal.creation model. +type AccountBankStatementImportJournalCreations []AccountBankStatementImportJournalCreation + +// AccountBankStatementImportJournalCreationModel is the odoo model name. +const AccountBankStatementImportJournalCreationModel = "account.bank.statement.import.journal.creation" + +// Many2One convert AccountBankStatementImportJournalCreation to *Many2One. +func (absijc *AccountBankStatementImportJournalCreation) Many2One() *Many2One { + return NewMany2One(absijc.Id.Get(), "") +} + +// CreateAccountBankStatementImportJournalCreation creates a new account.bank.statement.import.journal.creation model and returns its id. +func (c *Client) CreateAccountBankStatementImportJournalCreation(absijc *AccountBankStatementImportJournalCreation) (int64, error) { + return c.Create(AccountBankStatementImportJournalCreationModel, absijc) +} + +// UpdateAccountBankStatementImportJournalCreation updates an existing account.bank.statement.import.journal.creation record. +func (c *Client) UpdateAccountBankStatementImportJournalCreation(absijc *AccountBankStatementImportJournalCreation) error { + return c.UpdateAccountBankStatementImportJournalCreations([]int64{absijc.Id.Get()}, absijc) +} + +// UpdateAccountBankStatementImportJournalCreations updates existing account.bank.statement.import.journal.creation records. +// All records (represented by ids) will be updated by absijc values. +func (c *Client) UpdateAccountBankStatementImportJournalCreations(ids []int64, absijc *AccountBankStatementImportJournalCreation) error { + return c.Update(AccountBankStatementImportJournalCreationModel, ids, absijc) +} + +// DeleteAccountBankStatementImportJournalCreation deletes an existing account.bank.statement.import.journal.creation record. +func (c *Client) DeleteAccountBankStatementImportJournalCreation(id int64) error { + return c.DeleteAccountBankStatementImportJournalCreations([]int64{id}) +} + +// DeleteAccountBankStatementImportJournalCreations deletes existing account.bank.statement.import.journal.creation records. +func (c *Client) DeleteAccountBankStatementImportJournalCreations(ids []int64) error { + return c.Delete(AccountBankStatementImportJournalCreationModel, ids) +} + +// GetAccountBankStatementImportJournalCreation gets account.bank.statement.import.journal.creation existing record. +func (c *Client) GetAccountBankStatementImportJournalCreation(id int64) (*AccountBankStatementImportJournalCreation, error) { + absijcs, err := c.GetAccountBankStatementImportJournalCreations([]int64{id}) + if err != nil { + return nil, err + } + if absijcs != nil && len(*absijcs) > 0 { + return &((*absijcs)[0]), nil + } + return nil, fmt.Errorf("id %v of account.bank.statement.import.journal.creation not found", id) +} + +// GetAccountBankStatementImportJournalCreations gets account.bank.statement.import.journal.creation existing records. +func (c *Client) GetAccountBankStatementImportJournalCreations(ids []int64) (*AccountBankStatementImportJournalCreations, error) { + absijcs := &AccountBankStatementImportJournalCreations{} + if err := c.Read(AccountBankStatementImportJournalCreationModel, ids, nil, absijcs); err != nil { + return nil, err + } + return absijcs, nil +} + +// FindAccountBankStatementImportJournalCreation finds account.bank.statement.import.journal.creation record by querying it with criteria. +func (c *Client) FindAccountBankStatementImportJournalCreation(criteria *Criteria) (*AccountBankStatementImportJournalCreation, error) { + absijcs := &AccountBankStatementImportJournalCreations{} + if err := c.SearchRead(AccountBankStatementImportJournalCreationModel, criteria, NewOptions().Limit(1), absijcs); err != nil { + return nil, err + } + if absijcs != nil && len(*absijcs) > 0 { + return &((*absijcs)[0]), nil + } + return nil, fmt.Errorf("no account.bank.statement.import.journal.creation was found with criteria %v", criteria) +} + +// FindAccountBankStatementImportJournalCreations finds account.bank.statement.import.journal.creation records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountBankStatementImportJournalCreations(criteria *Criteria, options *Options) (*AccountBankStatementImportJournalCreations, error) { + absijcs := &AccountBankStatementImportJournalCreations{} + if err := c.SearchRead(AccountBankStatementImportJournalCreationModel, criteria, options, absijcs); err != nil { + return nil, err + } + return absijcs, nil +} + +// FindAccountBankStatementImportJournalCreationIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountBankStatementImportJournalCreationIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(AccountBankStatementImportJournalCreationModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindAccountBankStatementImportJournalCreationId finds record id by querying it with criteria. +func (c *Client) FindAccountBankStatementImportJournalCreationId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountBankStatementImportJournalCreationModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.bank.statement.import.journal.creation was found with criteria %v and options %v", criteria, options) +} diff --git a/account_bank_statement_line.go b/account_bank_statement_line.go new file mode 100644 index 00000000..5e460277 --- /dev/null +++ b/account_bank_statement_line.go @@ -0,0 +1,138 @@ +package odoo + +import ( + "fmt" +) + +// AccountBankStatementLine represents account.bank.statement.line model. +type AccountBankStatementLine struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AccountId *Many2One `xmlrpc:"account_id,omitempty"` + Amount *Float `xmlrpc:"amount,omitempty"` + AmountCurrency *Float `xmlrpc:"amount_currency,omitempty"` + BankAccountId *Many2One `xmlrpc:"bank_account_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"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + JournalCurrencyId *Many2One `xmlrpc:"journal_currency_id,omitempty"` + JournalEntryIds *Relation `xmlrpc:"journal_entry_ids,omitempty"` + JournalId *Many2One `xmlrpc:"journal_id,omitempty"` + MoveName *String `xmlrpc:"move_name,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Note *String `xmlrpc:"note,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PartnerName *String `xmlrpc:"partner_name,omitempty"` + Ref *String `xmlrpc:"ref,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + StatementId *Many2One `xmlrpc:"statement_id,omitempty"` + UniqueImportId *String `xmlrpc:"unique_import_id,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) { + return c.Create(AccountBankStatementLineModel, absl) +} + +// 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) +} + +// 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 + } + if absls != nil && len(*absls) > 0 { + return &((*absls)[0]), nil + } + return nil, fmt.Errorf("id %v of account.bank.statement.line not found", id) +} + +// 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 + } + if absls != nil && len(*absls) > 0 { + return &((*absls)[0]), nil + } + return nil, fmt.Errorf("no account.bank.statement.line was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(AccountBankStatementLineModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.bank.statement.line was found with criteria %v and options %v", criteria, options) +} diff --git a/account_cash_rounding.go b/account_cash_rounding.go new file mode 100644 index 00000000..fed810c0 --- /dev/null +++ b/account_cash_rounding.go @@ -0,0 +1,123 @@ +package odoo + +import ( + "fmt" +) + +// AccountCashRounding represents account.cash.rounding model. +type AccountCashRounding struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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"` + Name *String `xmlrpc:"name,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) { + return c.Create(AccountCashRoundingModel, acr) +} + +// 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) +} + +// 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 + } + if acrs != nil && len(*acrs) > 0 { + return &((*acrs)[0]), nil + } + return nil, fmt.Errorf("id %v of account.cash.rounding not found", id) +} + +// 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 + } + if acrs != nil && len(*acrs) > 0 { + return &((*acrs)[0]), nil + } + return nil, fmt.Errorf("no account.cash.rounding was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(AccountCashRoundingModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.cash.rounding was found with criteria %v and options %v", criteria, options) +} diff --git a/account_cashbox_line.go b/account_cashbox_line.go new file mode 100644 index 00000000..0ffb4799 --- /dev/null +++ b/account_cashbox_line.go @@ -0,0 +1,122 @@ +package odoo + +import ( + "fmt" +) + +// AccountCashboxLine represents account.cashbox.line model. +type AccountCashboxLine struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CashboxId *Many2One `xmlrpc:"cashbox_id,omitempty"` + CoinValue *Float `xmlrpc:"coin_value,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Number *Int `xmlrpc:"number,omitempty"` + Subtotal *Float `xmlrpc:"subtotal,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountCashboxLines represents array of account.cashbox.line model. +type AccountCashboxLines []AccountCashboxLine + +// AccountCashboxLineModel is the odoo model name. +const AccountCashboxLineModel = "account.cashbox.line" + +// Many2One convert AccountCashboxLine to *Many2One. +func (acl *AccountCashboxLine) Many2One() *Many2One { + return NewMany2One(acl.Id.Get(), "") +} + +// CreateAccountCashboxLine creates a new account.cashbox.line model and returns its id. +func (c *Client) CreateAccountCashboxLine(acl *AccountCashboxLine) (int64, error) { + return c.Create(AccountCashboxLineModel, acl) +} + +// UpdateAccountCashboxLine updates an existing account.cashbox.line record. +func (c *Client) UpdateAccountCashboxLine(acl *AccountCashboxLine) error { + return c.UpdateAccountCashboxLines([]int64{acl.Id.Get()}, acl) +} + +// UpdateAccountCashboxLines updates existing account.cashbox.line records. +// All records (represented by ids) will be updated by acl values. +func (c *Client) UpdateAccountCashboxLines(ids []int64, acl *AccountCashboxLine) error { + return c.Update(AccountCashboxLineModel, ids, acl) +} + +// DeleteAccountCashboxLine deletes an existing account.cashbox.line record. +func (c *Client) DeleteAccountCashboxLine(id int64) error { + return c.DeleteAccountCashboxLines([]int64{id}) +} + +// DeleteAccountCashboxLines deletes existing account.cashbox.line records. +func (c *Client) DeleteAccountCashboxLines(ids []int64) error { + return c.Delete(AccountCashboxLineModel, ids) +} + +// GetAccountCashboxLine gets account.cashbox.line existing record. +func (c *Client) GetAccountCashboxLine(id int64) (*AccountCashboxLine, error) { + acls, err := c.GetAccountCashboxLines([]int64{id}) + if err != nil { + return nil, err + } + if acls != nil && len(*acls) > 0 { + return &((*acls)[0]), nil + } + return nil, fmt.Errorf("id %v of account.cashbox.line not found", id) +} + +// GetAccountCashboxLines gets account.cashbox.line existing records. +func (c *Client) GetAccountCashboxLines(ids []int64) (*AccountCashboxLines, error) { + acls := &AccountCashboxLines{} + if err := c.Read(AccountCashboxLineModel, ids, nil, acls); err != nil { + return nil, err + } + return acls, nil +} + +// FindAccountCashboxLine finds account.cashbox.line record by querying it with criteria. +func (c *Client) FindAccountCashboxLine(criteria *Criteria) (*AccountCashboxLine, error) { + acls := &AccountCashboxLines{} + if err := c.SearchRead(AccountCashboxLineModel, criteria, NewOptions().Limit(1), acls); err != nil { + return nil, err + } + if acls != nil && len(*acls) > 0 { + return &((*acls)[0]), nil + } + return nil, fmt.Errorf("no account.cashbox.line was found with criteria %v", criteria) +} + +// FindAccountCashboxLines finds account.cashbox.line records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountCashboxLines(criteria *Criteria, options *Options) (*AccountCashboxLines, error) { + acls := &AccountCashboxLines{} + if err := c.SearchRead(AccountCashboxLineModel, criteria, options, acls); err != nil { + return nil, err + } + return acls, nil +} + +// FindAccountCashboxLineIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountCashboxLineIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(AccountCashboxLineModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindAccountCashboxLineId finds record id by querying it with criteria. +func (c *Client) FindAccountCashboxLineId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountCashboxLineModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.cashbox.line was found with criteria %v and options %v", criteria, options) +} diff --git a/account_chart_template.go b/account_chart_template.go new file mode 100644 index 00000000..09cc7ee7 --- /dev/null +++ b/account_chart_template.go @@ -0,0 +1,142 @@ +package odoo + +import ( + "fmt" +) + +// AccountChartTemplate represents account.chart.template model. +type AccountChartTemplate struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AccountIds *Relation `xmlrpc:"account_ids,omitempty"` + BankAccountCodePrefix *String `xmlrpc:"bank_account_code_prefix,omitempty"` + CashAccountCodePrefix *String `xmlrpc:"cash_account_code_prefix,omitempty"` + CodeDigits *Int `xmlrpc:"code_digits,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CompleteTaxSet *Bool `xmlrpc:"complete_tax_set,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"` + ExpenseCurrencyExchangeAccountId *Many2One `xmlrpc:"expense_currency_exchange_account_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IncomeCurrencyExchangeAccountId *Many2One `xmlrpc:"income_currency_exchange_account_id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + ParentId *Many2One `xmlrpc:"parent_id,omitempty"` + PropertyAccountExpenseCategId *Many2One `xmlrpc:"property_account_expense_categ_id,omitempty"` + PropertyAccountExpenseId *Many2One `xmlrpc:"property_account_expense_id,omitempty"` + PropertyAccountIncomeCategId *Many2One `xmlrpc:"property_account_income_categ_id,omitempty"` + PropertyAccountIncomeId *Many2One `xmlrpc:"property_account_income_id,omitempty"` + PropertyAccountPayableId *Many2One `xmlrpc:"property_account_payable_id,omitempty"` + PropertyAccountReceivableId *Many2One `xmlrpc:"property_account_receivable_id,omitempty"` + PropertyStockAccountInputCategId *Many2One `xmlrpc:"property_stock_account_input_categ_id,omitempty"` + PropertyStockAccountOutputCategId *Many2One `xmlrpc:"property_stock_account_output_categ_id,omitempty"` + PropertyStockValuationAccountId *Many2One `xmlrpc:"property_stock_valuation_account_id,omitempty"` + TaxTemplateIds *Relation `xmlrpc:"tax_template_ids,omitempty"` + TransferAccountId *Many2One `xmlrpc:"transfer_account_id,omitempty"` + UseAngloSaxon *Bool `xmlrpc:"use_anglo_saxon,omitempty"` + Visible *Bool `xmlrpc:"visible,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountChartTemplates represents array of account.chart.template model. +type AccountChartTemplates []AccountChartTemplate + +// AccountChartTemplateModel is the odoo model name. +const AccountChartTemplateModel = "account.chart.template" + +// Many2One convert AccountChartTemplate to *Many2One. +func (act *AccountChartTemplate) Many2One() *Many2One { + return NewMany2One(act.Id.Get(), "") +} + +// CreateAccountChartTemplate creates a new account.chart.template model and returns its id. +func (c *Client) CreateAccountChartTemplate(act *AccountChartTemplate) (int64, error) { + return c.Create(AccountChartTemplateModel, act) +} + +// UpdateAccountChartTemplate updates an existing account.chart.template record. +func (c *Client) UpdateAccountChartTemplate(act *AccountChartTemplate) error { + return c.UpdateAccountChartTemplates([]int64{act.Id.Get()}, act) +} + +// UpdateAccountChartTemplates updates existing account.chart.template records. +// All records (represented by ids) will be updated by act values. +func (c *Client) UpdateAccountChartTemplates(ids []int64, act *AccountChartTemplate) error { + return c.Update(AccountChartTemplateModel, ids, act) +} + +// DeleteAccountChartTemplate deletes an existing account.chart.template record. +func (c *Client) DeleteAccountChartTemplate(id int64) error { + return c.DeleteAccountChartTemplates([]int64{id}) +} + +// DeleteAccountChartTemplates deletes existing account.chart.template records. +func (c *Client) DeleteAccountChartTemplates(ids []int64) error { + return c.Delete(AccountChartTemplateModel, ids) +} + +// GetAccountChartTemplate gets account.chart.template existing record. +func (c *Client) GetAccountChartTemplate(id int64) (*AccountChartTemplate, error) { + acts, err := c.GetAccountChartTemplates([]int64{id}) + if err != nil { + return nil, err + } + if acts != nil && len(*acts) > 0 { + return &((*acts)[0]), nil + } + return nil, fmt.Errorf("id %v of account.chart.template not found", id) +} + +// GetAccountChartTemplates gets account.chart.template existing records. +func (c *Client) GetAccountChartTemplates(ids []int64) (*AccountChartTemplates, error) { + acts := &AccountChartTemplates{} + if err := c.Read(AccountChartTemplateModel, ids, nil, acts); err != nil { + return nil, err + } + return acts, nil +} + +// FindAccountChartTemplate finds account.chart.template record by querying it with criteria. +func (c *Client) FindAccountChartTemplate(criteria *Criteria) (*AccountChartTemplate, error) { + acts := &AccountChartTemplates{} + if err := c.SearchRead(AccountChartTemplateModel, criteria, NewOptions().Limit(1), acts); err != nil { + return nil, err + } + if acts != nil && len(*acts) > 0 { + return &((*acts)[0]), nil + } + return nil, fmt.Errorf("no account.chart.template was found with criteria %v", criteria) +} + +// FindAccountChartTemplates finds account.chart.template records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountChartTemplates(criteria *Criteria, options *Options) (*AccountChartTemplates, error) { + acts := &AccountChartTemplates{} + if err := c.SearchRead(AccountChartTemplateModel, criteria, options, acts); err != nil { + return nil, err + } + return acts, nil +} + +// FindAccountChartTemplateIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountChartTemplateIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(AccountChartTemplateModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindAccountChartTemplateId finds record id by querying it with criteria. +func (c *Client) FindAccountChartTemplateId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountChartTemplateModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.chart.template was found with criteria %v and options %v", criteria, options) +} diff --git a/account_common_account_report.go b/account_common_account_report.go new file mode 100644 index 00000000..78b8b7bc --- /dev/null +++ b/account_common_account_report.go @@ -0,0 +1,124 @@ +package odoo + +import ( + "fmt" +) + +// AccountCommonAccountReport represents account.common.account.report model. +type AccountCommonAccountReport struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` + DisplayAccount *Selection `xmlrpc:"display_account,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + JournalIds *Relation `xmlrpc:"journal_ids,omitempty"` + TargetMove *Selection `xmlrpc:"target_move,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountCommonAccountReports represents array of account.common.account.report model. +type AccountCommonAccountReports []AccountCommonAccountReport + +// AccountCommonAccountReportModel is the odoo model name. +const AccountCommonAccountReportModel = "account.common.account.report" + +// Many2One convert AccountCommonAccountReport to *Many2One. +func (acar *AccountCommonAccountReport) Many2One() *Many2One { + return NewMany2One(acar.Id.Get(), "") +} + +// CreateAccountCommonAccountReport creates a new account.common.account.report model and returns its id. +func (c *Client) CreateAccountCommonAccountReport(acar *AccountCommonAccountReport) (int64, error) { + return c.Create(AccountCommonAccountReportModel, acar) +} + +// UpdateAccountCommonAccountReport updates an existing account.common.account.report record. +func (c *Client) UpdateAccountCommonAccountReport(acar *AccountCommonAccountReport) error { + return c.UpdateAccountCommonAccountReports([]int64{acar.Id.Get()}, acar) +} + +// UpdateAccountCommonAccountReports updates existing account.common.account.report records. +// All records (represented by ids) will be updated by acar values. +func (c *Client) UpdateAccountCommonAccountReports(ids []int64, acar *AccountCommonAccountReport) error { + return c.Update(AccountCommonAccountReportModel, ids, acar) +} + +// DeleteAccountCommonAccountReport deletes an existing account.common.account.report record. +func (c *Client) DeleteAccountCommonAccountReport(id int64) error { + return c.DeleteAccountCommonAccountReports([]int64{id}) +} + +// DeleteAccountCommonAccountReports deletes existing account.common.account.report records. +func (c *Client) DeleteAccountCommonAccountReports(ids []int64) error { + return c.Delete(AccountCommonAccountReportModel, ids) +} + +// GetAccountCommonAccountReport gets account.common.account.report existing record. +func (c *Client) GetAccountCommonAccountReport(id int64) (*AccountCommonAccountReport, error) { + acars, err := c.GetAccountCommonAccountReports([]int64{id}) + if err != nil { + return nil, err + } + if acars != nil && len(*acars) > 0 { + return &((*acars)[0]), nil + } + return nil, fmt.Errorf("id %v of account.common.account.report not found", id) +} + +// GetAccountCommonAccountReports gets account.common.account.report existing records. +func (c *Client) GetAccountCommonAccountReports(ids []int64) (*AccountCommonAccountReports, error) { + acars := &AccountCommonAccountReports{} + if err := c.Read(AccountCommonAccountReportModel, ids, nil, acars); err != nil { + return nil, err + } + return acars, nil +} + +// FindAccountCommonAccountReport finds account.common.account.report record by querying it with criteria. +func (c *Client) FindAccountCommonAccountReport(criteria *Criteria) (*AccountCommonAccountReport, error) { + acars := &AccountCommonAccountReports{} + if err := c.SearchRead(AccountCommonAccountReportModel, criteria, NewOptions().Limit(1), acars); err != nil { + return nil, err + } + if acars != nil && len(*acars) > 0 { + return &((*acars)[0]), nil + } + return nil, fmt.Errorf("no account.common.account.report was found with criteria %v", criteria) +} + +// FindAccountCommonAccountReports finds account.common.account.report records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountCommonAccountReports(criteria *Criteria, options *Options) (*AccountCommonAccountReports, error) { + acars := &AccountCommonAccountReports{} + if err := c.SearchRead(AccountCommonAccountReportModel, criteria, options, acars); err != nil { + return nil, err + } + return acars, nil +} + +// FindAccountCommonAccountReportIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountCommonAccountReportIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(AccountCommonAccountReportModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindAccountCommonAccountReportId finds record id by querying it with criteria. +func (c *Client) FindAccountCommonAccountReportId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountCommonAccountReportModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.common.account.report was found with criteria %v and options %v", criteria, options) +} diff --git a/account_common_journal_report.go b/account_common_journal_report.go new file mode 100644 index 00000000..98bc907b --- /dev/null +++ b/account_common_journal_report.go @@ -0,0 +1,124 @@ +package odoo + +import ( + "fmt" +) + +// AccountCommonJournalReport represents account.common.journal.report model. +type AccountCommonJournalReport struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AmountCurrency *Bool `xmlrpc:"amount_currency,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"` + Id *Int `xmlrpc:"id,omitempty"` + JournalIds *Relation `xmlrpc:"journal_ids,omitempty"` + TargetMove *Selection `xmlrpc:"target_move,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountCommonJournalReports represents array of account.common.journal.report model. +type AccountCommonJournalReports []AccountCommonJournalReport + +// AccountCommonJournalReportModel is the odoo model name. +const AccountCommonJournalReportModel = "account.common.journal.report" + +// Many2One convert AccountCommonJournalReport to *Many2One. +func (acjr *AccountCommonJournalReport) Many2One() *Many2One { + return NewMany2One(acjr.Id.Get(), "") +} + +// CreateAccountCommonJournalReport creates a new account.common.journal.report model and returns its id. +func (c *Client) CreateAccountCommonJournalReport(acjr *AccountCommonJournalReport) (int64, error) { + return c.Create(AccountCommonJournalReportModel, acjr) +} + +// UpdateAccountCommonJournalReport updates an existing account.common.journal.report record. +func (c *Client) UpdateAccountCommonJournalReport(acjr *AccountCommonJournalReport) error { + return c.UpdateAccountCommonJournalReports([]int64{acjr.Id.Get()}, acjr) +} + +// UpdateAccountCommonJournalReports updates existing account.common.journal.report records. +// All records (represented by ids) will be updated by acjr values. +func (c *Client) UpdateAccountCommonJournalReports(ids []int64, acjr *AccountCommonJournalReport) error { + return c.Update(AccountCommonJournalReportModel, ids, acjr) +} + +// DeleteAccountCommonJournalReport deletes an existing account.common.journal.report record. +func (c *Client) DeleteAccountCommonJournalReport(id int64) error { + return c.DeleteAccountCommonJournalReports([]int64{id}) +} + +// DeleteAccountCommonJournalReports deletes existing account.common.journal.report records. +func (c *Client) DeleteAccountCommonJournalReports(ids []int64) error { + return c.Delete(AccountCommonJournalReportModel, ids) +} + +// GetAccountCommonJournalReport gets account.common.journal.report existing record. +func (c *Client) GetAccountCommonJournalReport(id int64) (*AccountCommonJournalReport, error) { + acjrs, err := c.GetAccountCommonJournalReports([]int64{id}) + if err != nil { + return nil, err + } + if acjrs != nil && len(*acjrs) > 0 { + return &((*acjrs)[0]), nil + } + return nil, fmt.Errorf("id %v of account.common.journal.report not found", id) +} + +// GetAccountCommonJournalReports gets account.common.journal.report existing records. +func (c *Client) GetAccountCommonJournalReports(ids []int64) (*AccountCommonJournalReports, error) { + acjrs := &AccountCommonJournalReports{} + if err := c.Read(AccountCommonJournalReportModel, ids, nil, acjrs); err != nil { + return nil, err + } + return acjrs, nil +} + +// FindAccountCommonJournalReport finds account.common.journal.report record by querying it with criteria. +func (c *Client) FindAccountCommonJournalReport(criteria *Criteria) (*AccountCommonJournalReport, error) { + acjrs := &AccountCommonJournalReports{} + if err := c.SearchRead(AccountCommonJournalReportModel, criteria, NewOptions().Limit(1), acjrs); err != nil { + return nil, err + } + if acjrs != nil && len(*acjrs) > 0 { + return &((*acjrs)[0]), nil + } + return nil, fmt.Errorf("no account.common.journal.report was found with criteria %v", criteria) +} + +// FindAccountCommonJournalReports finds account.common.journal.report records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountCommonJournalReports(criteria *Criteria, options *Options) (*AccountCommonJournalReports, error) { + acjrs := &AccountCommonJournalReports{} + if err := c.SearchRead(AccountCommonJournalReportModel, criteria, options, acjrs); err != nil { + return nil, err + } + return acjrs, nil +} + +// FindAccountCommonJournalReportIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountCommonJournalReportIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(AccountCommonJournalReportModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindAccountCommonJournalReportId finds record id by querying it with criteria. +func (c *Client) FindAccountCommonJournalReportId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountCommonJournalReportModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.common.journal.report was found with criteria %v and options %v", criteria, options) +} diff --git a/account_common_partner_report.go b/account_common_partner_report.go new file mode 100644 index 00000000..68b2991a --- /dev/null +++ b/account_common_partner_report.go @@ -0,0 +1,124 @@ +package odoo + +import ( + "fmt" +) + +// AccountCommonPartnerReport represents account.common.partner.report model. +type AccountCommonPartnerReport struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` + Id *Int `xmlrpc:"id,omitempty"` + JournalIds *Relation `xmlrpc:"journal_ids,omitempty"` + ResultSelection *Selection `xmlrpc:"result_selection,omitempty"` + TargetMove *Selection `xmlrpc:"target_move,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountCommonPartnerReports represents array of account.common.partner.report model. +type AccountCommonPartnerReports []AccountCommonPartnerReport + +// AccountCommonPartnerReportModel is the odoo model name. +const AccountCommonPartnerReportModel = "account.common.partner.report" + +// Many2One convert AccountCommonPartnerReport to *Many2One. +func (acpr *AccountCommonPartnerReport) Many2One() *Many2One { + return NewMany2One(acpr.Id.Get(), "") +} + +// CreateAccountCommonPartnerReport creates a new account.common.partner.report model and returns its id. +func (c *Client) CreateAccountCommonPartnerReport(acpr *AccountCommonPartnerReport) (int64, error) { + return c.Create(AccountCommonPartnerReportModel, acpr) +} + +// UpdateAccountCommonPartnerReport updates an existing account.common.partner.report record. +func (c *Client) UpdateAccountCommonPartnerReport(acpr *AccountCommonPartnerReport) error { + return c.UpdateAccountCommonPartnerReports([]int64{acpr.Id.Get()}, acpr) +} + +// UpdateAccountCommonPartnerReports updates existing account.common.partner.report records. +// All records (represented by ids) will be updated by acpr values. +func (c *Client) UpdateAccountCommonPartnerReports(ids []int64, acpr *AccountCommonPartnerReport) error { + return c.Update(AccountCommonPartnerReportModel, ids, acpr) +} + +// DeleteAccountCommonPartnerReport deletes an existing account.common.partner.report record. +func (c *Client) DeleteAccountCommonPartnerReport(id int64) error { + return c.DeleteAccountCommonPartnerReports([]int64{id}) +} + +// DeleteAccountCommonPartnerReports deletes existing account.common.partner.report records. +func (c *Client) DeleteAccountCommonPartnerReports(ids []int64) error { + return c.Delete(AccountCommonPartnerReportModel, ids) +} + +// GetAccountCommonPartnerReport gets account.common.partner.report existing record. +func (c *Client) GetAccountCommonPartnerReport(id int64) (*AccountCommonPartnerReport, error) { + acprs, err := c.GetAccountCommonPartnerReports([]int64{id}) + if err != nil { + return nil, err + } + if acprs != nil && len(*acprs) > 0 { + return &((*acprs)[0]), nil + } + return nil, fmt.Errorf("id %v of account.common.partner.report not found", id) +} + +// GetAccountCommonPartnerReports gets account.common.partner.report existing records. +func (c *Client) GetAccountCommonPartnerReports(ids []int64) (*AccountCommonPartnerReports, error) { + acprs := &AccountCommonPartnerReports{} + if err := c.Read(AccountCommonPartnerReportModel, ids, nil, acprs); err != nil { + return nil, err + } + return acprs, nil +} + +// FindAccountCommonPartnerReport finds account.common.partner.report record by querying it with criteria. +func (c *Client) FindAccountCommonPartnerReport(criteria *Criteria) (*AccountCommonPartnerReport, error) { + acprs := &AccountCommonPartnerReports{} + if err := c.SearchRead(AccountCommonPartnerReportModel, criteria, NewOptions().Limit(1), acprs); err != nil { + return nil, err + } + if acprs != nil && len(*acprs) > 0 { + return &((*acprs)[0]), nil + } + return nil, fmt.Errorf("no account.common.partner.report was found with criteria %v", criteria) +} + +// FindAccountCommonPartnerReports finds account.common.partner.report records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountCommonPartnerReports(criteria *Criteria, options *Options) (*AccountCommonPartnerReports, error) { + acprs := &AccountCommonPartnerReports{} + if err := c.SearchRead(AccountCommonPartnerReportModel, criteria, options, acprs); err != nil { + return nil, err + } + return acprs, nil +} + +// FindAccountCommonPartnerReportIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountCommonPartnerReportIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(AccountCommonPartnerReportModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindAccountCommonPartnerReportId finds record id by querying it with criteria. +func (c *Client) FindAccountCommonPartnerReportId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountCommonPartnerReportModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.common.partner.report was found with criteria %v and options %v", criteria, options) +} diff --git a/account_common_report.go b/account_common_report.go new file mode 100644 index 00000000..e2d24249 --- /dev/null +++ b/account_common_report.go @@ -0,0 +1,123 @@ +package odoo + +import ( + "fmt" +) + +// AccountCommonReport represents account.common.report model. +type AccountCommonReport struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` + Id *Int `xmlrpc:"id,omitempty"` + JournalIds *Relation `xmlrpc:"journal_ids,omitempty"` + TargetMove *Selection `xmlrpc:"target_move,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountCommonReports represents array of account.common.report model. +type AccountCommonReports []AccountCommonReport + +// AccountCommonReportModel is the odoo model name. +const AccountCommonReportModel = "account.common.report" + +// Many2One convert AccountCommonReport to *Many2One. +func (acr *AccountCommonReport) Many2One() *Many2One { + return NewMany2One(acr.Id.Get(), "") +} + +// CreateAccountCommonReport creates a new account.common.report model and returns its id. +func (c *Client) CreateAccountCommonReport(acr *AccountCommonReport) (int64, error) { + return c.Create(AccountCommonReportModel, acr) +} + +// UpdateAccountCommonReport updates an existing account.common.report record. +func (c *Client) UpdateAccountCommonReport(acr *AccountCommonReport) error { + return c.UpdateAccountCommonReports([]int64{acr.Id.Get()}, acr) +} + +// UpdateAccountCommonReports updates existing account.common.report records. +// All records (represented by ids) will be updated by acr values. +func (c *Client) UpdateAccountCommonReports(ids []int64, acr *AccountCommonReport) error { + return c.Update(AccountCommonReportModel, ids, acr) +} + +// DeleteAccountCommonReport deletes an existing account.common.report record. +func (c *Client) DeleteAccountCommonReport(id int64) error { + return c.DeleteAccountCommonReports([]int64{id}) +} + +// DeleteAccountCommonReports deletes existing account.common.report records. +func (c *Client) DeleteAccountCommonReports(ids []int64) error { + return c.Delete(AccountCommonReportModel, ids) +} + +// GetAccountCommonReport gets account.common.report existing record. +func (c *Client) GetAccountCommonReport(id int64) (*AccountCommonReport, error) { + acrs, err := c.GetAccountCommonReports([]int64{id}) + if err != nil { + return nil, err + } + if acrs != nil && len(*acrs) > 0 { + return &((*acrs)[0]), nil + } + return nil, fmt.Errorf("id %v of account.common.report not found", id) +} + +// GetAccountCommonReports gets account.common.report existing records. +func (c *Client) GetAccountCommonReports(ids []int64) (*AccountCommonReports, error) { + acrs := &AccountCommonReports{} + if err := c.Read(AccountCommonReportModel, ids, nil, acrs); err != nil { + return nil, err + } + return acrs, nil +} + +// FindAccountCommonReport finds account.common.report record by querying it with criteria. +func (c *Client) FindAccountCommonReport(criteria *Criteria) (*AccountCommonReport, error) { + acrs := &AccountCommonReports{} + if err := c.SearchRead(AccountCommonReportModel, criteria, NewOptions().Limit(1), acrs); err != nil { + return nil, err + } + if acrs != nil && len(*acrs) > 0 { + return &((*acrs)[0]), nil + } + return nil, fmt.Errorf("no account.common.report was found with criteria %v", criteria) +} + +// FindAccountCommonReports finds account.common.report records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountCommonReports(criteria *Criteria, options *Options) (*AccountCommonReports, error) { + acrs := &AccountCommonReports{} + if err := c.SearchRead(AccountCommonReportModel, criteria, options, acrs); err != nil { + return nil, err + } + return acrs, nil +} + +// FindAccountCommonReportIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountCommonReportIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(AccountCommonReportModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindAccountCommonReportId finds record id by querying it with criteria. +func (c *Client) FindAccountCommonReportId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountCommonReportModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.common.report was found with criteria %v and options %v", criteria, options) +} diff --git a/account_financial_report.go b/account_financial_report.go new file mode 100644 index 00000000..f8930eb9 --- /dev/null +++ b/account_financial_report.go @@ -0,0 +1,130 @@ +package odoo + +import ( + "fmt" +) + +// AccountFinancialReport represents account.financial.report model. +type AccountFinancialReport struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AccountIds *Relation `xmlrpc:"account_ids,omitempty"` + AccountReportId *Many2One `xmlrpc:"account_report_id,omitempty"` + AccountTypeIds *Relation `xmlrpc:"account_type_ids,omitempty"` + ChildrenIds *Relation `xmlrpc:"children_ids,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayDetail *Selection `xmlrpc:"display_detail,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Level *Int `xmlrpc:"level,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + ParentId *Many2One `xmlrpc:"parent_id,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + Sign *Selection `xmlrpc:"sign,omitempty"` + StyleOverwrite *Selection `xmlrpc:"style_overwrite,omitempty"` + Type *Selection `xmlrpc:"type,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountFinancialReports represents array of account.financial.report model. +type AccountFinancialReports []AccountFinancialReport + +// AccountFinancialReportModel is the odoo model name. +const AccountFinancialReportModel = "account.financial.report" + +// Many2One convert AccountFinancialReport to *Many2One. +func (afr *AccountFinancialReport) Many2One() *Many2One { + return NewMany2One(afr.Id.Get(), "") +} + +// CreateAccountFinancialReport creates a new account.financial.report model and returns its id. +func (c *Client) CreateAccountFinancialReport(afr *AccountFinancialReport) (int64, error) { + return c.Create(AccountFinancialReportModel, afr) +} + +// UpdateAccountFinancialReport updates an existing account.financial.report record. +func (c *Client) UpdateAccountFinancialReport(afr *AccountFinancialReport) error { + return c.UpdateAccountFinancialReports([]int64{afr.Id.Get()}, afr) +} + +// UpdateAccountFinancialReports updates existing account.financial.report records. +// All records (represented by ids) will be updated by afr values. +func (c *Client) UpdateAccountFinancialReports(ids []int64, afr *AccountFinancialReport) error { + return c.Update(AccountFinancialReportModel, ids, afr) +} + +// DeleteAccountFinancialReport deletes an existing account.financial.report record. +func (c *Client) DeleteAccountFinancialReport(id int64) error { + return c.DeleteAccountFinancialReports([]int64{id}) +} + +// DeleteAccountFinancialReports deletes existing account.financial.report records. +func (c *Client) DeleteAccountFinancialReports(ids []int64) error { + return c.Delete(AccountFinancialReportModel, ids) +} + +// GetAccountFinancialReport gets account.financial.report existing record. +func (c *Client) GetAccountFinancialReport(id int64) (*AccountFinancialReport, error) { + afrs, err := c.GetAccountFinancialReports([]int64{id}) + if err != nil { + return nil, err + } + if afrs != nil && len(*afrs) > 0 { + return &((*afrs)[0]), nil + } + return nil, fmt.Errorf("id %v of account.financial.report not found", id) +} + +// GetAccountFinancialReports gets account.financial.report existing records. +func (c *Client) GetAccountFinancialReports(ids []int64) (*AccountFinancialReports, error) { + afrs := &AccountFinancialReports{} + if err := c.Read(AccountFinancialReportModel, ids, nil, afrs); err != nil { + return nil, err + } + return afrs, nil +} + +// FindAccountFinancialReport finds account.financial.report record by querying it with criteria. +func (c *Client) FindAccountFinancialReport(criteria *Criteria) (*AccountFinancialReport, error) { + afrs := &AccountFinancialReports{} + if err := c.SearchRead(AccountFinancialReportModel, criteria, NewOptions().Limit(1), afrs); err != nil { + return nil, err + } + if afrs != nil && len(*afrs) > 0 { + return &((*afrs)[0]), nil + } + return nil, fmt.Errorf("no account.financial.report was found with criteria %v", criteria) +} + +// FindAccountFinancialReports finds account.financial.report records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountFinancialReports(criteria *Criteria, options *Options) (*AccountFinancialReports, error) { + afrs := &AccountFinancialReports{} + if err := c.SearchRead(AccountFinancialReportModel, criteria, options, afrs); err != nil { + return nil, err + } + return afrs, nil +} + +// FindAccountFinancialReportIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountFinancialReportIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(AccountFinancialReportModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindAccountFinancialReportId finds record id by querying it with criteria. +func (c *Client) FindAccountFinancialReportId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountFinancialReportModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.financial.report was found with criteria %v and options %v", criteria, options) +} diff --git a/account_financial_year_op.go b/account_financial_year_op.go new file mode 100644 index 00000000..e5ab36ec --- /dev/null +++ b/account_financial_year_op.go @@ -0,0 +1,124 @@ +package odoo + +import ( + "fmt" +) + +// AccountFinancialYearOp represents account.financial.year.op model. +type AccountFinancialYearOp struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AccountSetupFyDataDone *Bool `xmlrpc:"account_setup_fy_data_done,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"` + 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) { + return c.Create(AccountFinancialYearOpModel, afyo) +} + +// 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) +} + +// 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 + } + if afyos != nil && len(*afyos) > 0 { + return &((*afyos)[0]), nil + } + return nil, fmt.Errorf("id %v of account.financial.year.op not found", id) +} + +// 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 + } + if afyos != nil && len(*afyos) > 0 { + return &((*afyos)[0]), nil + } + return nil, fmt.Errorf("no account.financial.year.op was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(AccountFinancialYearOpModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.financial.year.op was found with criteria %v and options %v", criteria, options) +} diff --git a/account_fiscal_position.go b/account_fiscal_position.go new file mode 100644 index 00000000..2074f314 --- /dev/null +++ b/account_fiscal_position.go @@ -0,0 +1,133 @@ +package odoo + +import ( + "fmt" +) + +// AccountFiscalPosition represents account.fiscal.position model. +type AccountFiscalPosition struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AccountIds *Relation `xmlrpc:"account_ids,omitempty"` + Active *Bool `xmlrpc:"active,omitempty"` + AutoApply *Bool `xmlrpc:"auto_apply,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"` + 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"` + VatRequired *Bool `xmlrpc:"vat_required,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` + ZipFrom *Int `xmlrpc:"zip_from,omitempty"` + ZipTo *Int `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) { + return c.Create(AccountFiscalPositionModel, afp) +} + +// 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) +} + +// 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 + } + if afps != nil && len(*afps) > 0 { + return &((*afps)[0]), nil + } + return nil, fmt.Errorf("id %v of account.fiscal.position not found", id) +} + +// 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 + } + if afps != nil && len(*afps) > 0 { + return &((*afps)[0]), nil + } + return nil, fmt.Errorf("no account.fiscal.position was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(AccountFiscalPositionModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.fiscal.position was found with criteria %v and options %v", criteria, options) +} diff --git a/account_fiscal_position_account.go b/account_fiscal_position_account.go new file mode 100644 index 00000000..690a92b7 --- /dev/null +++ b/account_fiscal_position_account.go @@ -0,0 +1,121 @@ +package odoo + +import ( + "fmt" +) + +// AccountFiscalPositionAccount represents account.fiscal.position.account model. +type AccountFiscalPositionAccount struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AccountDestId *Many2One `xmlrpc:"account_dest_id,omitempty"` + AccountSrcId *Many2One `xmlrpc:"account_src_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) { + return c.Create(AccountFiscalPositionAccountModel, afpa) +} + +// 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) +} + +// 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 + } + if afpas != nil && len(*afpas) > 0 { + return &((*afpas)[0]), nil + } + return nil, fmt.Errorf("id %v of account.fiscal.position.account not found", id) +} + +// 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 + } + if afpas != nil && len(*afpas) > 0 { + return &((*afpas)[0]), nil + } + return nil, fmt.Errorf("no account.fiscal.position.account was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(AccountFiscalPositionAccountModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.fiscal.position.account was found with criteria %v and options %v", criteria, options) +} diff --git a/account_fiscal_position_account_template.go b/account_fiscal_position_account_template.go new file mode 100644 index 00000000..92d9a6a4 --- /dev/null +++ b/account_fiscal_position_account_template.go @@ -0,0 +1,121 @@ +package odoo + +import ( + "fmt" +) + +// AccountFiscalPositionAccountTemplate represents account.fiscal.position.account.template model. +type AccountFiscalPositionAccountTemplate struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AccountDestId *Many2One `xmlrpc:"account_dest_id,omitempty"` + AccountSrcId *Many2One `xmlrpc:"account_src_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"` +} + +// AccountFiscalPositionAccountTemplates represents array of account.fiscal.position.account.template model. +type AccountFiscalPositionAccountTemplates []AccountFiscalPositionAccountTemplate + +// AccountFiscalPositionAccountTemplateModel is the odoo model name. +const AccountFiscalPositionAccountTemplateModel = "account.fiscal.position.account.template" + +// Many2One convert AccountFiscalPositionAccountTemplate to *Many2One. +func (afpat *AccountFiscalPositionAccountTemplate) Many2One() *Many2One { + return NewMany2One(afpat.Id.Get(), "") +} + +// CreateAccountFiscalPositionAccountTemplate creates a new account.fiscal.position.account.template model and returns its id. +func (c *Client) CreateAccountFiscalPositionAccountTemplate(afpat *AccountFiscalPositionAccountTemplate) (int64, error) { + return c.Create(AccountFiscalPositionAccountTemplateModel, afpat) +} + +// UpdateAccountFiscalPositionAccountTemplate updates an existing account.fiscal.position.account.template record. +func (c *Client) UpdateAccountFiscalPositionAccountTemplate(afpat *AccountFiscalPositionAccountTemplate) error { + return c.UpdateAccountFiscalPositionAccountTemplates([]int64{afpat.Id.Get()}, afpat) +} + +// UpdateAccountFiscalPositionAccountTemplates updates existing account.fiscal.position.account.template records. +// All records (represented by ids) will be updated by afpat values. +func (c *Client) UpdateAccountFiscalPositionAccountTemplates(ids []int64, afpat *AccountFiscalPositionAccountTemplate) error { + return c.Update(AccountFiscalPositionAccountTemplateModel, ids, afpat) +} + +// DeleteAccountFiscalPositionAccountTemplate deletes an existing account.fiscal.position.account.template record. +func (c *Client) DeleteAccountFiscalPositionAccountTemplate(id int64) error { + return c.DeleteAccountFiscalPositionAccountTemplates([]int64{id}) +} + +// DeleteAccountFiscalPositionAccountTemplates deletes existing account.fiscal.position.account.template records. +func (c *Client) DeleteAccountFiscalPositionAccountTemplates(ids []int64) error { + return c.Delete(AccountFiscalPositionAccountTemplateModel, ids) +} + +// GetAccountFiscalPositionAccountTemplate gets account.fiscal.position.account.template existing record. +func (c *Client) GetAccountFiscalPositionAccountTemplate(id int64) (*AccountFiscalPositionAccountTemplate, error) { + afpats, err := c.GetAccountFiscalPositionAccountTemplates([]int64{id}) + if err != nil { + return nil, err + } + if afpats != nil && len(*afpats) > 0 { + return &((*afpats)[0]), nil + } + return nil, fmt.Errorf("id %v of account.fiscal.position.account.template not found", id) +} + +// GetAccountFiscalPositionAccountTemplates gets account.fiscal.position.account.template existing records. +func (c *Client) GetAccountFiscalPositionAccountTemplates(ids []int64) (*AccountFiscalPositionAccountTemplates, error) { + afpats := &AccountFiscalPositionAccountTemplates{} + if err := c.Read(AccountFiscalPositionAccountTemplateModel, ids, nil, afpats); err != nil { + return nil, err + } + return afpats, nil +} + +// FindAccountFiscalPositionAccountTemplate finds account.fiscal.position.account.template record by querying it with criteria. +func (c *Client) FindAccountFiscalPositionAccountTemplate(criteria *Criteria) (*AccountFiscalPositionAccountTemplate, error) { + afpats := &AccountFiscalPositionAccountTemplates{} + if err := c.SearchRead(AccountFiscalPositionAccountTemplateModel, criteria, NewOptions().Limit(1), afpats); err != nil { + return nil, err + } + if afpats != nil && len(*afpats) > 0 { + return &((*afpats)[0]), nil + } + return nil, fmt.Errorf("no account.fiscal.position.account.template was found with criteria %v", criteria) +} + +// FindAccountFiscalPositionAccountTemplates finds account.fiscal.position.account.template records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountFiscalPositionAccountTemplates(criteria *Criteria, options *Options) (*AccountFiscalPositionAccountTemplates, error) { + afpats := &AccountFiscalPositionAccountTemplates{} + if err := c.SearchRead(AccountFiscalPositionAccountTemplateModel, criteria, options, afpats); err != nil { + return nil, err + } + return afpats, nil +} + +// FindAccountFiscalPositionAccountTemplateIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountFiscalPositionAccountTemplateIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(AccountFiscalPositionAccountTemplateModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindAccountFiscalPositionAccountTemplateId finds record id by querying it with criteria. +func (c *Client) FindAccountFiscalPositionAccountTemplateId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountFiscalPositionAccountTemplateModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.fiscal.position.account.template was found with criteria %v and options %v", criteria, options) +} diff --git a/account_fiscal_position_tax.go b/account_fiscal_position_tax.go new file mode 100644 index 00000000..ba48e5c5 --- /dev/null +++ b/account_fiscal_position_tax.go @@ -0,0 +1,121 @@ +package odoo + +import ( + "fmt" +) + +// AccountFiscalPositionTax represents account.fiscal.position.tax model. +type AccountFiscalPositionTax struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` + 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) { + return c.Create(AccountFiscalPositionTaxModel, afpt) +} + +// 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) +} + +// 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 + } + if afpts != nil && len(*afpts) > 0 { + return &((*afpts)[0]), nil + } + return nil, fmt.Errorf("id %v of account.fiscal.position.tax not found", id) +} + +// 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 + } + if afpts != nil && len(*afpts) > 0 { + return &((*afpts)[0]), nil + } + return nil, fmt.Errorf("no account.fiscal.position.tax was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(AccountFiscalPositionTaxModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.fiscal.position.tax was found with criteria %v and options %v", criteria, options) +} diff --git a/account_fiscal_position_tax_template.go b/account_fiscal_position_tax_template.go new file mode 100644 index 00000000..6fef1586 --- /dev/null +++ b/account_fiscal_position_tax_template.go @@ -0,0 +1,121 @@ +package odoo + +import ( + "fmt" +) + +// AccountFiscalPositionTaxTemplate represents account.fiscal.position.tax.template model. +type AccountFiscalPositionTaxTemplate struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` + 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"` +} + +// AccountFiscalPositionTaxTemplates represents array of account.fiscal.position.tax.template model. +type AccountFiscalPositionTaxTemplates []AccountFiscalPositionTaxTemplate + +// AccountFiscalPositionTaxTemplateModel is the odoo model name. +const AccountFiscalPositionTaxTemplateModel = "account.fiscal.position.tax.template" + +// Many2One convert AccountFiscalPositionTaxTemplate to *Many2One. +func (afptt *AccountFiscalPositionTaxTemplate) Many2One() *Many2One { + return NewMany2One(afptt.Id.Get(), "") +} + +// CreateAccountFiscalPositionTaxTemplate creates a new account.fiscal.position.tax.template model and returns its id. +func (c *Client) CreateAccountFiscalPositionTaxTemplate(afptt *AccountFiscalPositionTaxTemplate) (int64, error) { + return c.Create(AccountFiscalPositionTaxTemplateModel, afptt) +} + +// UpdateAccountFiscalPositionTaxTemplate updates an existing account.fiscal.position.tax.template record. +func (c *Client) UpdateAccountFiscalPositionTaxTemplate(afptt *AccountFiscalPositionTaxTemplate) error { + return c.UpdateAccountFiscalPositionTaxTemplates([]int64{afptt.Id.Get()}, afptt) +} + +// UpdateAccountFiscalPositionTaxTemplates updates existing account.fiscal.position.tax.template records. +// All records (represented by ids) will be updated by afptt values. +func (c *Client) UpdateAccountFiscalPositionTaxTemplates(ids []int64, afptt *AccountFiscalPositionTaxTemplate) error { + return c.Update(AccountFiscalPositionTaxTemplateModel, ids, afptt) +} + +// DeleteAccountFiscalPositionTaxTemplate deletes an existing account.fiscal.position.tax.template record. +func (c *Client) DeleteAccountFiscalPositionTaxTemplate(id int64) error { + return c.DeleteAccountFiscalPositionTaxTemplates([]int64{id}) +} + +// DeleteAccountFiscalPositionTaxTemplates deletes existing account.fiscal.position.tax.template records. +func (c *Client) DeleteAccountFiscalPositionTaxTemplates(ids []int64) error { + return c.Delete(AccountFiscalPositionTaxTemplateModel, ids) +} + +// GetAccountFiscalPositionTaxTemplate gets account.fiscal.position.tax.template existing record. +func (c *Client) GetAccountFiscalPositionTaxTemplate(id int64) (*AccountFiscalPositionTaxTemplate, error) { + afptts, err := c.GetAccountFiscalPositionTaxTemplates([]int64{id}) + if err != nil { + return nil, err + } + if afptts != nil && len(*afptts) > 0 { + return &((*afptts)[0]), nil + } + return nil, fmt.Errorf("id %v of account.fiscal.position.tax.template not found", id) +} + +// GetAccountFiscalPositionTaxTemplates gets account.fiscal.position.tax.template existing records. +func (c *Client) GetAccountFiscalPositionTaxTemplates(ids []int64) (*AccountFiscalPositionTaxTemplates, error) { + afptts := &AccountFiscalPositionTaxTemplates{} + if err := c.Read(AccountFiscalPositionTaxTemplateModel, ids, nil, afptts); err != nil { + return nil, err + } + return afptts, nil +} + +// FindAccountFiscalPositionTaxTemplate finds account.fiscal.position.tax.template record by querying it with criteria. +func (c *Client) FindAccountFiscalPositionTaxTemplate(criteria *Criteria) (*AccountFiscalPositionTaxTemplate, error) { + afptts := &AccountFiscalPositionTaxTemplates{} + if err := c.SearchRead(AccountFiscalPositionTaxTemplateModel, criteria, NewOptions().Limit(1), afptts); err != nil { + return nil, err + } + if afptts != nil && len(*afptts) > 0 { + return &((*afptts)[0]), nil + } + return nil, fmt.Errorf("no account.fiscal.position.tax.template was found with criteria %v", criteria) +} + +// FindAccountFiscalPositionTaxTemplates finds account.fiscal.position.tax.template records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountFiscalPositionTaxTemplates(criteria *Criteria, options *Options) (*AccountFiscalPositionTaxTemplates, error) { + afptts := &AccountFiscalPositionTaxTemplates{} + if err := c.SearchRead(AccountFiscalPositionTaxTemplateModel, criteria, options, afptts); err != nil { + return nil, err + } + return afptts, nil +} + +// FindAccountFiscalPositionTaxTemplateIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountFiscalPositionTaxTemplateIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(AccountFiscalPositionTaxTemplateModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindAccountFiscalPositionTaxTemplateId finds record id by querying it with criteria. +func (c *Client) FindAccountFiscalPositionTaxTemplateId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountFiscalPositionTaxTemplateModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.fiscal.position.tax.template was found with criteria %v and options %v", criteria, options) +} diff --git a/account_fiscal_position_template.go b/account_fiscal_position_template.go new file mode 100644 index 00000000..b6ed644d --- /dev/null +++ b/account_fiscal_position_template.go @@ -0,0 +1,131 @@ +package odoo + +import ( + "fmt" +) + +// AccountFiscalPositionTemplate represents account.fiscal.position.template model. +type AccountFiscalPositionTemplate struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AccountIds *Relation `xmlrpc:"account_ids,omitempty"` + AutoApply *Bool `xmlrpc:"auto_apply,omitempty"` + ChartTemplateId *Many2One `xmlrpc:"chart_template_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"` + 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"` + TaxIds *Relation `xmlrpc:"tax_ids,omitempty"` + VatRequired *Bool `xmlrpc:"vat_required,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` + ZipFrom *Int `xmlrpc:"zip_from,omitempty"` + ZipTo *Int `xmlrpc:"zip_to,omitempty"` +} + +// AccountFiscalPositionTemplates represents array of account.fiscal.position.template model. +type AccountFiscalPositionTemplates []AccountFiscalPositionTemplate + +// AccountFiscalPositionTemplateModel is the odoo model name. +const AccountFiscalPositionTemplateModel = "account.fiscal.position.template" + +// Many2One convert AccountFiscalPositionTemplate to *Many2One. +func (afpt *AccountFiscalPositionTemplate) Many2One() *Many2One { + return NewMany2One(afpt.Id.Get(), "") +} + +// CreateAccountFiscalPositionTemplate creates a new account.fiscal.position.template model and returns its id. +func (c *Client) CreateAccountFiscalPositionTemplate(afpt *AccountFiscalPositionTemplate) (int64, error) { + return c.Create(AccountFiscalPositionTemplateModel, afpt) +} + +// UpdateAccountFiscalPositionTemplate updates an existing account.fiscal.position.template record. +func (c *Client) UpdateAccountFiscalPositionTemplate(afpt *AccountFiscalPositionTemplate) error { + return c.UpdateAccountFiscalPositionTemplates([]int64{afpt.Id.Get()}, afpt) +} + +// UpdateAccountFiscalPositionTemplates updates existing account.fiscal.position.template records. +// All records (represented by ids) will be updated by afpt values. +func (c *Client) UpdateAccountFiscalPositionTemplates(ids []int64, afpt *AccountFiscalPositionTemplate) error { + return c.Update(AccountFiscalPositionTemplateModel, ids, afpt) +} + +// DeleteAccountFiscalPositionTemplate deletes an existing account.fiscal.position.template record. +func (c *Client) DeleteAccountFiscalPositionTemplate(id int64) error { + return c.DeleteAccountFiscalPositionTemplates([]int64{id}) +} + +// DeleteAccountFiscalPositionTemplates deletes existing account.fiscal.position.template records. +func (c *Client) DeleteAccountFiscalPositionTemplates(ids []int64) error { + return c.Delete(AccountFiscalPositionTemplateModel, ids) +} + +// GetAccountFiscalPositionTemplate gets account.fiscal.position.template existing record. +func (c *Client) GetAccountFiscalPositionTemplate(id int64) (*AccountFiscalPositionTemplate, error) { + afpts, err := c.GetAccountFiscalPositionTemplates([]int64{id}) + if err != nil { + return nil, err + } + if afpts != nil && len(*afpts) > 0 { + return &((*afpts)[0]), nil + } + return nil, fmt.Errorf("id %v of account.fiscal.position.template not found", id) +} + +// GetAccountFiscalPositionTemplates gets account.fiscal.position.template existing records. +func (c *Client) GetAccountFiscalPositionTemplates(ids []int64) (*AccountFiscalPositionTemplates, error) { + afpts := &AccountFiscalPositionTemplates{} + if err := c.Read(AccountFiscalPositionTemplateModel, ids, nil, afpts); err != nil { + return nil, err + } + return afpts, nil +} + +// FindAccountFiscalPositionTemplate finds account.fiscal.position.template record by querying it with criteria. +func (c *Client) FindAccountFiscalPositionTemplate(criteria *Criteria) (*AccountFiscalPositionTemplate, error) { + afpts := &AccountFiscalPositionTemplates{} + if err := c.SearchRead(AccountFiscalPositionTemplateModel, criteria, NewOptions().Limit(1), afpts); err != nil { + return nil, err + } + if afpts != nil && len(*afpts) > 0 { + return &((*afpts)[0]), nil + } + return nil, fmt.Errorf("no account.fiscal.position.template was found with criteria %v", criteria) +} + +// FindAccountFiscalPositionTemplates finds account.fiscal.position.template records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountFiscalPositionTemplates(criteria *Criteria, options *Options) (*AccountFiscalPositionTemplates, error) { + afpts := &AccountFiscalPositionTemplates{} + if err := c.SearchRead(AccountFiscalPositionTemplateModel, criteria, options, afpts); err != nil { + return nil, err + } + return afpts, nil +} + +// FindAccountFiscalPositionTemplateIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountFiscalPositionTemplateIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(AccountFiscalPositionTemplateModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindAccountFiscalPositionTemplateId finds record id by querying it with criteria. +func (c *Client) FindAccountFiscalPositionTemplateId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountFiscalPositionTemplateModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.fiscal.position.template was found with criteria %v and options %v", criteria, options) +} diff --git a/account_fr_fec.go b/account_fr_fec.go new file mode 100644 index 00000000..3de8a164 --- /dev/null +++ b/account_fr_fec.go @@ -0,0 +1,123 @@ +package odoo + +import ( + "fmt" +) + +// AccountFrFec represents account.fr.fec model. +type AccountFrFec struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` + ExportType *Selection `xmlrpc:"export_type,omitempty"` + FecData *String `xmlrpc:"fec_data,omitempty"` + Filename *String `xmlrpc:"filename,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountFrFecs represents array of account.fr.fec model. +type AccountFrFecs []AccountFrFec + +// AccountFrFecModel is the odoo model name. +const AccountFrFecModel = "account.fr.fec" + +// Many2One convert AccountFrFec to *Many2One. +func (aff *AccountFrFec) Many2One() *Many2One { + return NewMany2One(aff.Id.Get(), "") +} + +// CreateAccountFrFec creates a new account.fr.fec model and returns its id. +func (c *Client) CreateAccountFrFec(aff *AccountFrFec) (int64, error) { + return c.Create(AccountFrFecModel, aff) +} + +// UpdateAccountFrFec updates an existing account.fr.fec record. +func (c *Client) UpdateAccountFrFec(aff *AccountFrFec) error { + return c.UpdateAccountFrFecs([]int64{aff.Id.Get()}, aff) +} + +// UpdateAccountFrFecs updates existing account.fr.fec records. +// All records (represented by ids) will be updated by aff values. +func (c *Client) UpdateAccountFrFecs(ids []int64, aff *AccountFrFec) error { + return c.Update(AccountFrFecModel, ids, aff) +} + +// DeleteAccountFrFec deletes an existing account.fr.fec record. +func (c *Client) DeleteAccountFrFec(id int64) error { + return c.DeleteAccountFrFecs([]int64{id}) +} + +// DeleteAccountFrFecs deletes existing account.fr.fec records. +func (c *Client) DeleteAccountFrFecs(ids []int64) error { + return c.Delete(AccountFrFecModel, ids) +} + +// GetAccountFrFec gets account.fr.fec existing record. +func (c *Client) GetAccountFrFec(id int64) (*AccountFrFec, error) { + affs, err := c.GetAccountFrFecs([]int64{id}) + if err != nil { + return nil, err + } + if affs != nil && len(*affs) > 0 { + return &((*affs)[0]), nil + } + return nil, fmt.Errorf("id %v of account.fr.fec not found", id) +} + +// GetAccountFrFecs gets account.fr.fec existing records. +func (c *Client) GetAccountFrFecs(ids []int64) (*AccountFrFecs, error) { + affs := &AccountFrFecs{} + if err := c.Read(AccountFrFecModel, ids, nil, affs); err != nil { + return nil, err + } + return affs, nil +} + +// FindAccountFrFec finds account.fr.fec record by querying it with criteria. +func (c *Client) FindAccountFrFec(criteria *Criteria) (*AccountFrFec, error) { + affs := &AccountFrFecs{} + if err := c.SearchRead(AccountFrFecModel, criteria, NewOptions().Limit(1), affs); err != nil { + return nil, err + } + if affs != nil && len(*affs) > 0 { + return &((*affs)[0]), nil + } + return nil, fmt.Errorf("no account.fr.fec was found with criteria %v", criteria) +} + +// FindAccountFrFecs finds account.fr.fec records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountFrFecs(criteria *Criteria, options *Options) (*AccountFrFecs, error) { + affs := &AccountFrFecs{} + if err := c.SearchRead(AccountFrFecModel, criteria, options, affs); err != nil { + return nil, err + } + return affs, nil +} + +// FindAccountFrFecIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountFrFecIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(AccountFrFecModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindAccountFrFecId finds record id by querying it with criteria. +func (c *Client) FindAccountFrFecId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountFrFecModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.fr.fec was found with criteria %v and options %v", criteria, options) +} diff --git a/account_full_reconcile.go b/account_full_reconcile.go new file mode 100644 index 00000000..3eb08078 --- /dev/null +++ b/account_full_reconcile.go @@ -0,0 +1,122 @@ +package odoo + +import ( + "fmt" +) + +// AccountFullReconcile represents account.full.reconcile model. +type AccountFullReconcile struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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"` + Name *String `xmlrpc:"name,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) { + return c.Create(AccountFullReconcileModel, afr) +} + +// 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) +} + +// 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 + } + if afrs != nil && len(*afrs) > 0 { + return &((*afrs)[0]), nil + } + return nil, fmt.Errorf("id %v of account.full.reconcile not found", id) +} + +// 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 + } + if afrs != nil && len(*afrs) > 0 { + return &((*afrs)[0]), nil + } + return nil, fmt.Errorf("no account.full.reconcile was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(AccountFullReconcileModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.full.reconcile was found with criteria %v and options %v", criteria, options) +} diff --git a/account_group.go b/account_group.go new file mode 100644 index 00000000..1023cc8c --- /dev/null +++ b/account_group.go @@ -0,0 +1,123 @@ +package odoo + +import ( + "fmt" +) + +// AccountGroup represents account.group model. +type AccountGroup struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CodePrefix *String `xmlrpc:"code_prefix,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"` + ParentLeft *Int `xmlrpc:"parent_left,omitempty"` + ParentRight *Int `xmlrpc:"parent_right,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) { + return c.Create(AccountGroupModel, ag) +} + +// 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) +} + +// 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 + } + if ags != nil && len(*ags) > 0 { + return &((*ags)[0]), nil + } + return nil, fmt.Errorf("id %v of account.group not found", id) +} + +// 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 + } + if ags != nil && len(*ags) > 0 { + return &((*ags)[0]), nil + } + return nil, fmt.Errorf("no account.group was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(AccountGroupModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.group was found with criteria %v and options %v", criteria, options) +} diff --git a/account_invoice.go b/account_invoice.go index 2582ef8e..3a0e18a4 100644 --- a/account_invoice.go +++ b/account_invoice.go @@ -6,94 +6,92 @@ import ( // AccountInvoice represents account.invoice model. type AccountInvoice struct { - LastUpdate *Time `xmlrpc:"__last_update,omptempty"` - AccessToken *String `xmlrpc:"access_token,omptempty"` - AccountId *Many2One `xmlrpc:"account_id,omptempty"` - ActivityDateDeadline *Time `xmlrpc:"activity_date_deadline,omptempty"` - ActivityIds *Relation `xmlrpc:"activity_ids,omptempty"` - ActivityState *Selection `xmlrpc:"activity_state,omptempty"` - ActivitySummary *String `xmlrpc:"activity_summary,omptempty"` - ActivityTypeId *Many2One `xmlrpc:"activity_type_id,omptempty"` - ActivityUserId *Many2One `xmlrpc:"activity_user_id,omptempty"` - AmountTax *Float `xmlrpc:"amount_tax,omptempty"` - AmountTotal *Float `xmlrpc:"amount_total,omptempty"` - AmountTotalCompanySigned *Float `xmlrpc:"amount_total_company_signed,omptempty"` - AmountTotalSigned *Float `xmlrpc:"amount_total_signed,omptempty"` - AmountUntaxed *Float `xmlrpc:"amount_untaxed,omptempty"` - AmountUntaxedSigned *Float `xmlrpc:"amount_untaxed_signed,omptempty"` - CampaignId *Many2One `xmlrpc:"campaign_id,omptempty"` - CashRoundingId *Many2One `xmlrpc:"cash_rounding_id,omptempty"` - Comment *String `xmlrpc:"comment,omptempty"` - CommercialPartnerId *Many2One `xmlrpc:"commercial_partner_id,omptempty"` - CompanyCurrencyId *Many2One `xmlrpc:"company_currency_id,omptempty"` - CompanyId *Many2One `xmlrpc:"company_id,omptempty"` - CreateDate *Time `xmlrpc:"create_date,omptempty"` - CreateUid *Many2One `xmlrpc:"create_uid,omptempty"` - CurrencyId *Many2One `xmlrpc:"currency_id,omptempty"` - Date *Time `xmlrpc:"date,omptempty"` - DateDue *Time `xmlrpc:"date_due,omptempty"` - DateInvoice *Time `xmlrpc:"date_invoice,omptempty"` - DisplayName *String `xmlrpc:"display_name,omptempty"` - FiscalPositionId *Many2One `xmlrpc:"fiscal_position_id,omptempty"` - HasOutstanding *Bool `xmlrpc:"has_outstanding,omptempty"` - Id *Int `xmlrpc:"id,omptempty"` - InNote *String `xmlrpc:"in_note,omptempty"` - IncotermsId *Many2One `xmlrpc:"incoterms_id,omptempty"` - InvoiceLineIds *Relation `xmlrpc:"invoice_line_ids,omptempty"` - JournalId *Many2One `xmlrpc:"journal_id,omptempty"` - MachineInvoice *Bool `xmlrpc:"machine_invoice,omptempty"` - MachineInvoiceTitle *String `xmlrpc:"machine_invoice_title,omptempty"` - MachinePurchaseOrder *String `xmlrpc:"machine_purchase_order,omptempty"` - MediumId *Many2One `xmlrpc:"medium_id,omptempty"` - MessageChannelIds *Relation `xmlrpc:"message_channel_ids,omptempty"` - MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omptempty"` - MessageIds *Relation `xmlrpc:"message_ids,omptempty"` - MessageIsFollower *Bool `xmlrpc:"message_is_follower,omptempty"` - MessageLastPost *Time `xmlrpc:"message_last_post,omptempty"` - MessageNeedaction *Bool `xmlrpc:"message_needaction,omptempty"` - MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omptempty"` - MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omptempty"` - MessageUnread *Bool `xmlrpc:"message_unread,omptempty"` - MessageUnreadCounter *Int `xmlrpc:"message_unread_counter,omptempty"` - MoveId *Many2One `xmlrpc:"move_id,omptempty"` - MoveName *String `xmlrpc:"move_name,omptempty"` - Name *String `xmlrpc:"name,omptempty"` - Number *String `xmlrpc:"number,omptempty"` - Origin *String `xmlrpc:"origin,omptempty"` - OutNote *String `xmlrpc:"out_note,omptempty"` - OutstandingCreditsDebitsWidget *String `xmlrpc:"outstanding_credits_debits_widget,omptempty"` - PartnerBankId *Many2One `xmlrpc:"partner_bank_id,omptempty"` - PartnerId *Many2One `xmlrpc:"partner_id,omptempty"` - PartnerShippingId *Many2One `xmlrpc:"partner_shipping_id,omptempty"` - PaymentIds *Relation `xmlrpc:"payment_ids,omptempty"` - PaymentMoveLineIds *Relation `xmlrpc:"payment_move_line_ids,omptempty"` - PaymentTermId *Many2One `xmlrpc:"payment_term_id,omptempty"` - PaymentsWidget *String `xmlrpc:"payments_widget,omptempty"` - PortalUrl *String `xmlrpc:"portal_url,omptempty"` - PurchaseId *Many2One `xmlrpc:"purchase_id,omptempty"` - QuantityTotal *Float `xmlrpc:"quantity_total,omptempty"` - Reconciled *Bool `xmlrpc:"reconciled,omptempty"` - Reference *String `xmlrpc:"reference,omptempty"` - ReferenceType *Selection `xmlrpc:"reference_type,omptempty"` - RefundInvoiceId *Many2One `xmlrpc:"refund_invoice_id,omptempty"` - RefundInvoiceIds *Relation `xmlrpc:"refund_invoice_ids,omptempty"` - Residual *Float `xmlrpc:"residual,omptempty"` - ResidualCompanySigned *Float `xmlrpc:"residual_company_signed,omptempty"` - ResidualSigned *Float `xmlrpc:"residual_signed,omptempty"` - Sent *Bool `xmlrpc:"sent,omptempty"` - SequenceNumberNext *String `xmlrpc:"sequence_number_next,omptempty"` - SequenceNumberNextPrefix *String `xmlrpc:"sequence_number_next_prefix,omptempty"` - SourceId *Many2One `xmlrpc:"source_id,omptempty"` - State *Selection `xmlrpc:"state,omptempty"` - TaxLineIds *Relation `xmlrpc:"tax_line_ids,omptempty"` - TeamId *Many2One `xmlrpc:"team_id,omptempty"` - TimesheetCount *Int `xmlrpc:"timesheet_count,omptempty"` - TimesheetIds *Relation `xmlrpc:"timesheet_ids,omptempty"` - Type *Selection `xmlrpc:"type,omptempty"` - UserId *Many2One `xmlrpc:"user_id,omptempty"` - WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omptempty"` - WriteDate *Time `xmlrpc:"write_date,omptempty"` - WriteUid *Many2One `xmlrpc:"write_uid,omptempty"` + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AccessToken *String `xmlrpc:"access_token,omitempty"` + AccountId *Many2One `xmlrpc:"account_id,omitempty"` + ActivityDateDeadline *Time `xmlrpc:"activity_date_deadline,omitempty"` + ActivityIds *Relation `xmlrpc:"activity_ids,omitempty"` + ActivityState *Selection `xmlrpc:"activity_state,omitempty"` + ActivitySummary *String `xmlrpc:"activity_summary,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"` + AmountTotalCompanySigned *Float `xmlrpc:"amount_total_company_signed,omitempty"` + AmountTotalSigned *Float `xmlrpc:"amount_total_signed,omitempty"` + AmountUntaxed *Float `xmlrpc:"amount_untaxed,omitempty"` + AmountUntaxedSigned *Float `xmlrpc:"amount_untaxed_signed,omitempty"` + CampaignId *Many2One `xmlrpc:"campaign_id,omitempty"` + CashRoundingId *Many2One `xmlrpc:"cash_rounding_id,omitempty"` + Comment *String `xmlrpc:"comment,omitempty"` + CommercialPartnerId *Many2One `xmlrpc:"commercial_partner_id,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"` + Date *Time `xmlrpc:"date,omitempty"` + DateDue *Time `xmlrpc:"date_due,omitempty"` + DateInvoice *Time `xmlrpc:"date_invoice,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + FiscalPositionId *Many2One `xmlrpc:"fiscal_position_id,omitempty"` + HasOutstanding *Bool `xmlrpc:"has_outstanding,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IncotermsId *Many2One `xmlrpc:"incoterms_id,omitempty"` + InvoiceLineIds *Relation `xmlrpc:"invoice_line_ids,omitempty"` + JournalId *Many2One `xmlrpc:"journal_id,omitempty"` + MachineInvoice *Bool `xmlrpc:"machine_invoice,omitempty"` + MachineInvoiceTitle *String `xmlrpc:"machine_invoice_title,omitempty"` + MachinePurchaseOrder *String `xmlrpc:"machine_purchase_order,omitempty"` + MediumId *Many2One `xmlrpc:"medium_id,omitempty"` + MessageChannelIds *Relation `xmlrpc:"message_channel_ids,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageLastPost *Time `xmlrpc:"message_last_post,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MessageUnread *Bool `xmlrpc:"message_unread,omitempty"` + MessageUnreadCounter *Int `xmlrpc:"message_unread_counter,omitempty"` + MoveId *Many2One `xmlrpc:"move_id,omitempty"` + MoveName *String `xmlrpc:"move_name,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Number *String `xmlrpc:"number,omitempty"` + Origin *String `xmlrpc:"origin,omitempty"` + OutstandingCreditsDebitsWidget *String `xmlrpc:"outstanding_credits_debits_widget,omitempty"` + PartnerBankId *Many2One `xmlrpc:"partner_bank_id,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PartnerShippingId *Many2One `xmlrpc:"partner_shipping_id,omitempty"` + PaymentIds *Relation `xmlrpc:"payment_ids,omitempty"` + PaymentMoveLineIds *Relation `xmlrpc:"payment_move_line_ids,omitempty"` + PaymentTermId *Many2One `xmlrpc:"payment_term_id,omitempty"` + PaymentsWidget *String `xmlrpc:"payments_widget,omitempty"` + PortalUrl *String `xmlrpc:"portal_url,omitempty"` + PurchaseId *Many2One `xmlrpc:"purchase_id,omitempty"` + QuantityTotal *Float `xmlrpc:"quantity_total,omitempty"` + Reconciled *Bool `xmlrpc:"reconciled,omitempty"` + Reference *String `xmlrpc:"reference,omitempty"` + ReferenceType *Selection `xmlrpc:"reference_type,omitempty"` + RefundInvoiceId *Many2One `xmlrpc:"refund_invoice_id,omitempty"` + RefundInvoiceIds *Relation `xmlrpc:"refund_invoice_ids,omitempty"` + Residual *Float `xmlrpc:"residual,omitempty"` + ResidualCompanySigned *Float `xmlrpc:"residual_company_signed,omitempty"` + ResidualSigned *Float `xmlrpc:"residual_signed,omitempty"` + Sent *Bool `xmlrpc:"sent,omitempty"` + SequenceNumberNext *String `xmlrpc:"sequence_number_next,omitempty"` + SequenceNumberNextPrefix *String `xmlrpc:"sequence_number_next_prefix,omitempty"` + SourceId *Many2One `xmlrpc:"source_id,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + TaxLineIds *Relation `xmlrpc:"tax_line_ids,omitempty"` + TeamId *Many2One `xmlrpc:"team_id,omitempty"` + TimesheetCount *Int `xmlrpc:"timesheet_count,omitempty"` + TimesheetIds *Relation `xmlrpc:"timesheet_ids,omitempty"` + Type *Selection `xmlrpc:"type,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"` } // AccountInvoices represents array of account.invoice model. @@ -163,7 +161,7 @@ func (c *Client) FindAccountInvoice(criteria *Criteria) (*AccountInvoice, error) if ais != nil && len(*ais) > 0 { return &((*ais)[0]), nil } - return nil, fmt.Errorf("account.invoice was not found") + return nil, fmt.Errorf("no account.invoice was found with criteria %v", criteria) } // FindAccountInvoices finds account.invoice records by querying it @@ -195,5 +193,5 @@ func (c *Client) FindAccountInvoiceId(criteria *Criteria, options *Options) (int if len(ids) > 0 { return ids[0], nil } - return -1, fmt.Errorf("account.invoice was not found") + return -1, fmt.Errorf("no account.invoice was found with criteria %v and options %v", criteria, options) } diff --git a/account_invoice_confirm.go b/account_invoice_confirm.go new file mode 100644 index 00000000..14c69bdb --- /dev/null +++ b/account_invoice_confirm.go @@ -0,0 +1,118 @@ +package odoo + +import ( + "fmt" +) + +// AccountInvoiceConfirm represents account.invoice.confirm model. +type AccountInvoiceConfirm struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` +} + +// AccountInvoiceConfirms represents array of account.invoice.confirm model. +type AccountInvoiceConfirms []AccountInvoiceConfirm + +// AccountInvoiceConfirmModel is the odoo model name. +const AccountInvoiceConfirmModel = "account.invoice.confirm" + +// Many2One convert AccountInvoiceConfirm to *Many2One. +func (aic *AccountInvoiceConfirm) Many2One() *Many2One { + return NewMany2One(aic.Id.Get(), "") +} + +// CreateAccountInvoiceConfirm creates a new account.invoice.confirm model and returns its id. +func (c *Client) CreateAccountInvoiceConfirm(aic *AccountInvoiceConfirm) (int64, error) { + return c.Create(AccountInvoiceConfirmModel, aic) +} + +// UpdateAccountInvoiceConfirm updates an existing account.invoice.confirm record. +func (c *Client) UpdateAccountInvoiceConfirm(aic *AccountInvoiceConfirm) error { + return c.UpdateAccountInvoiceConfirms([]int64{aic.Id.Get()}, aic) +} + +// UpdateAccountInvoiceConfirms updates existing account.invoice.confirm records. +// All records (represented by ids) will be updated by aic values. +func (c *Client) UpdateAccountInvoiceConfirms(ids []int64, aic *AccountInvoiceConfirm) error { + return c.Update(AccountInvoiceConfirmModel, ids, aic) +} + +// DeleteAccountInvoiceConfirm deletes an existing account.invoice.confirm record. +func (c *Client) DeleteAccountInvoiceConfirm(id int64) error { + return c.DeleteAccountInvoiceConfirms([]int64{id}) +} + +// DeleteAccountInvoiceConfirms deletes existing account.invoice.confirm records. +func (c *Client) DeleteAccountInvoiceConfirms(ids []int64) error { + return c.Delete(AccountInvoiceConfirmModel, ids) +} + +// GetAccountInvoiceConfirm gets account.invoice.confirm existing record. +func (c *Client) GetAccountInvoiceConfirm(id int64) (*AccountInvoiceConfirm, error) { + aics, err := c.GetAccountInvoiceConfirms([]int64{id}) + if err != nil { + return nil, err + } + if aics != nil && len(*aics) > 0 { + return &((*aics)[0]), nil + } + return nil, fmt.Errorf("id %v of account.invoice.confirm not found", id) +} + +// GetAccountInvoiceConfirms gets account.invoice.confirm existing records. +func (c *Client) GetAccountInvoiceConfirms(ids []int64) (*AccountInvoiceConfirms, error) { + aics := &AccountInvoiceConfirms{} + if err := c.Read(AccountInvoiceConfirmModel, ids, nil, aics); err != nil { + return nil, err + } + return aics, nil +} + +// FindAccountInvoiceConfirm finds account.invoice.confirm record by querying it with criteria. +func (c *Client) FindAccountInvoiceConfirm(criteria *Criteria) (*AccountInvoiceConfirm, error) { + aics := &AccountInvoiceConfirms{} + if err := c.SearchRead(AccountInvoiceConfirmModel, criteria, NewOptions().Limit(1), aics); err != nil { + return nil, err + } + if aics != nil && len(*aics) > 0 { + return &((*aics)[0]), nil + } + return nil, fmt.Errorf("no account.invoice.confirm was found with criteria %v", criteria) +} + +// FindAccountInvoiceConfirms finds account.invoice.confirm records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountInvoiceConfirms(criteria *Criteria, options *Options) (*AccountInvoiceConfirms, error) { + aics := &AccountInvoiceConfirms{} + if err := c.SearchRead(AccountInvoiceConfirmModel, criteria, options, aics); err != nil { + return nil, err + } + return aics, nil +} + +// FindAccountInvoiceConfirmIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountInvoiceConfirmIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(AccountInvoiceConfirmModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindAccountInvoiceConfirmId finds record id by querying it with criteria. +func (c *Client) FindAccountInvoiceConfirmId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountInvoiceConfirmModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.invoice.confirm was found with criteria %v and options %v", criteria, options) +} diff --git a/account_invoice_line.go b/account_invoice_line.go index 0c363fad..7a114f7f 100644 --- a/account_invoice_line.go +++ b/account_invoice_line.go @@ -6,40 +6,40 @@ import ( // AccountInvoiceLine represents account.invoice.line model. type AccountInvoiceLine struct { - LastUpdate *Time `xmlrpc:"__last_update,omptempty"` - AccountAnalyticId *Many2One `xmlrpc:"account_analytic_id,omptempty"` - AccountId *Many2One `xmlrpc:"account_id,omptempty"` - AnalyticTagIds *Relation `xmlrpc:"analytic_tag_ids,omptempty"` - CompanyCurrencyId *Many2One `xmlrpc:"company_currency_id,omptempty"` - CompanyId *Many2One `xmlrpc:"company_id,omptempty"` - CreateDate *Time `xmlrpc:"create_date,omptempty"` - CreateUid *Many2One `xmlrpc:"create_uid,omptempty"` - CurrencyId *Many2One `xmlrpc:"currency_id,omptempty"` - Discount *Float `xmlrpc:"discount,omptempty"` - DisplayName *String `xmlrpc:"display_name,omptempty"` - Id *Int `xmlrpc:"id,omptempty"` - InvoiceId *Many2One `xmlrpc:"invoice_id,omptempty"` - InvoiceLineTaxIds *Relation `xmlrpc:"invoice_line_tax_ids,omptempty"` - IsRoundingLine *Bool `xmlrpc:"is_rounding_line,omptempty"` - LayoutCategoryId *Many2One `xmlrpc:"layout_category_id,omptempty"` - LayoutCategorySequence *Int `xmlrpc:"layout_category_sequence,omptempty"` - Name *String `xmlrpc:"name,omptempty"` - Origin *String `xmlrpc:"origin,omptempty"` - PartnerId *Many2One `xmlrpc:"partner_id,omptempty"` - PriceSubtotal *Float `xmlrpc:"price_subtotal,omptempty"` - PriceSubtotalSigned *Float `xmlrpc:"price_subtotal_signed,omptempty"` - PriceTotal *Float `xmlrpc:"price_total,omptempty"` - PriceUnit *Float `xmlrpc:"price_unit,omptempty"` - ProductId *Many2One `xmlrpc:"product_id,omptempty"` - ProductImage *String `xmlrpc:"product_image,omptempty"` - PurchaseId *Many2One `xmlrpc:"purchase_id,omptempty"` - PurchaseLineId *Many2One `xmlrpc:"purchase_line_id,omptempty"` - Quantity *Float `xmlrpc:"quantity,omptempty"` - SaleLineIds *Relation `xmlrpc:"sale_line_ids,omptempty"` - Sequence *Int `xmlrpc:"sequence,omptempty"` - UomId *Many2One `xmlrpc:"uom_id,omptempty"` - WriteDate *Time `xmlrpc:"write_date,omptempty"` - WriteUid *Many2One `xmlrpc:"write_uid,omptempty"` + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AccountAnalyticId *Many2One `xmlrpc:"account_analytic_id,omitempty"` + AccountId *Many2One `xmlrpc:"account_id,omitempty"` + AnalyticTagIds *Relation `xmlrpc:"analytic_tag_ids,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"` + Discount *Float `xmlrpc:"discount,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + InvoiceId *Many2One `xmlrpc:"invoice_id,omitempty"` + InvoiceLineTaxIds *Relation `xmlrpc:"invoice_line_tax_ids,omitempty"` + IsRoundingLine *Bool `xmlrpc:"is_rounding_line,omitempty"` + LayoutCategoryId *Many2One `xmlrpc:"layout_category_id,omitempty"` + LayoutCategorySequence *Int `xmlrpc:"layout_category_sequence,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Origin *String `xmlrpc:"origin,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PriceSubtotal *Float `xmlrpc:"price_subtotal,omitempty"` + PriceSubtotalSigned *Float `xmlrpc:"price_subtotal_signed,omitempty"` + PriceTotal *Float `xmlrpc:"price_total,omitempty"` + PriceUnit *Float `xmlrpc:"price_unit,omitempty"` + ProductId *Many2One `xmlrpc:"product_id,omitempty"` + ProductImage *String `xmlrpc:"product_image,omitempty"` + PurchaseId *Many2One `xmlrpc:"purchase_id,omitempty"` + PurchaseLineId *Many2One `xmlrpc:"purchase_line_id,omitempty"` + Quantity *Float `xmlrpc:"quantity,omitempty"` + SaleLineIds *Relation `xmlrpc:"sale_line_ids,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + UomId *Many2One `xmlrpc:"uom_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` } // AccountInvoiceLines represents array of account.invoice.line model. @@ -109,7 +109,7 @@ func (c *Client) FindAccountInvoiceLine(criteria *Criteria) (*AccountInvoiceLine if ails != nil && len(*ails) > 0 { return &((*ails)[0]), nil } - return nil, fmt.Errorf("account.invoice.line was not found") + return nil, fmt.Errorf("no account.invoice.line was found with criteria %v", criteria) } // FindAccountInvoiceLines finds account.invoice.line records by querying it @@ -141,5 +141,5 @@ func (c *Client) FindAccountInvoiceLineId(criteria *Criteria, options *Options) if len(ids) > 0 { return ids[0], nil } - return -1, fmt.Errorf("account.invoice.line was not found") + return -1, fmt.Errorf("no account.invoice.line was found with criteria %v and options %v", criteria, options) } diff --git a/account_invoice_refund.go b/account_invoice_refund.go new file mode 100644 index 00000000..5dd27daa --- /dev/null +++ b/account_invoice_refund.go @@ -0,0 +1,123 @@ +package odoo + +import ( + "fmt" +) + +// AccountInvoiceRefund represents account.invoice.refund model. +type AccountInvoiceRefund struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Date *Time `xmlrpc:"date,omitempty"` + DateInvoice *Time `xmlrpc:"date_invoice,omitempty"` + Description *String `xmlrpc:"description,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + FilterRefund *Selection `xmlrpc:"filter_refund,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + RefundOnly *Bool `xmlrpc:"refund_only,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountInvoiceRefunds represents array of account.invoice.refund model. +type AccountInvoiceRefunds []AccountInvoiceRefund + +// AccountInvoiceRefundModel is the odoo model name. +const AccountInvoiceRefundModel = "account.invoice.refund" + +// Many2One convert AccountInvoiceRefund to *Many2One. +func (air *AccountInvoiceRefund) Many2One() *Many2One { + return NewMany2One(air.Id.Get(), "") +} + +// CreateAccountInvoiceRefund creates a new account.invoice.refund model and returns its id. +func (c *Client) CreateAccountInvoiceRefund(air *AccountInvoiceRefund) (int64, error) { + return c.Create(AccountInvoiceRefundModel, air) +} + +// UpdateAccountInvoiceRefund updates an existing account.invoice.refund record. +func (c *Client) UpdateAccountInvoiceRefund(air *AccountInvoiceRefund) error { + return c.UpdateAccountInvoiceRefunds([]int64{air.Id.Get()}, air) +} + +// UpdateAccountInvoiceRefunds updates existing account.invoice.refund records. +// All records (represented by ids) will be updated by air values. +func (c *Client) UpdateAccountInvoiceRefunds(ids []int64, air *AccountInvoiceRefund) error { + return c.Update(AccountInvoiceRefundModel, ids, air) +} + +// DeleteAccountInvoiceRefund deletes an existing account.invoice.refund record. +func (c *Client) DeleteAccountInvoiceRefund(id int64) error { + return c.DeleteAccountInvoiceRefunds([]int64{id}) +} + +// DeleteAccountInvoiceRefunds deletes existing account.invoice.refund records. +func (c *Client) DeleteAccountInvoiceRefunds(ids []int64) error { + return c.Delete(AccountInvoiceRefundModel, ids) +} + +// GetAccountInvoiceRefund gets account.invoice.refund existing record. +func (c *Client) GetAccountInvoiceRefund(id int64) (*AccountInvoiceRefund, error) { + airs, err := c.GetAccountInvoiceRefunds([]int64{id}) + if err != nil { + return nil, err + } + if airs != nil && len(*airs) > 0 { + return &((*airs)[0]), nil + } + return nil, fmt.Errorf("id %v of account.invoice.refund not found", id) +} + +// GetAccountInvoiceRefunds gets account.invoice.refund existing records. +func (c *Client) GetAccountInvoiceRefunds(ids []int64) (*AccountInvoiceRefunds, error) { + airs := &AccountInvoiceRefunds{} + if err := c.Read(AccountInvoiceRefundModel, ids, nil, airs); err != nil { + return nil, err + } + return airs, nil +} + +// FindAccountInvoiceRefund finds account.invoice.refund record by querying it with criteria. +func (c *Client) FindAccountInvoiceRefund(criteria *Criteria) (*AccountInvoiceRefund, error) { + airs := &AccountInvoiceRefunds{} + if err := c.SearchRead(AccountInvoiceRefundModel, criteria, NewOptions().Limit(1), airs); err != nil { + return nil, err + } + if airs != nil && len(*airs) > 0 { + return &((*airs)[0]), nil + } + return nil, fmt.Errorf("no account.invoice.refund was found with criteria %v", criteria) +} + +// FindAccountInvoiceRefunds finds account.invoice.refund records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountInvoiceRefunds(criteria *Criteria, options *Options) (*AccountInvoiceRefunds, error) { + airs := &AccountInvoiceRefunds{} + if err := c.SearchRead(AccountInvoiceRefundModel, criteria, options, airs); err != nil { + return nil, err + } + return airs, nil +} + +// FindAccountInvoiceRefundIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountInvoiceRefundIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(AccountInvoiceRefundModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindAccountInvoiceRefundId finds record id by querying it with criteria. +func (c *Client) FindAccountInvoiceRefundId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountInvoiceRefundModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.invoice.refund was found with criteria %v and options %v", criteria, options) +} diff --git a/account_invoice_report.go b/account_invoice_report.go new file mode 100644 index 00000000..5e470ce5 --- /dev/null +++ b/account_invoice_report.go @@ -0,0 +1,144 @@ +package odoo + +import ( + "fmt" +) + +// AccountInvoiceReport represents account.invoice.report model. +type AccountInvoiceReport struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AccountAnalyticId *Many2One `xmlrpc:"account_analytic_id,omitempty"` + AccountId *Many2One `xmlrpc:"account_id,omitempty"` + AccountLineId *Many2One `xmlrpc:"account_line_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"` + CurrencyRate *Float `xmlrpc:"currency_rate,omitempty"` + Date *Time `xmlrpc:"date,omitempty"` + DateDue *Time `xmlrpc:"date_due,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + FiscalPositionId *Many2One `xmlrpc:"fiscal_position_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + JournalId *Many2One `xmlrpc:"journal_id,omitempty"` + Nbr *Int `xmlrpc:"nbr,omitempty"` + PartnerBankId *Many2One `xmlrpc:"partner_bank_id,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PaymentTermId *Many2One `xmlrpc:"payment_term_id,omitempty"` + PriceAverage *Float `xmlrpc:"price_average,omitempty"` + PriceTotal *Float `xmlrpc:"price_total,omitempty"` + ProductId *Many2One `xmlrpc:"product_id,omitempty"` + ProductQty *Float `xmlrpc:"product_qty,omitempty"` + Residual *Float `xmlrpc:"residual,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + TeamId *Many2One `xmlrpc:"team_id,omitempty"` + Type *Selection `xmlrpc:"type,omitempty"` + UomName *String `xmlrpc:"uom_name,omitempty"` + UserCurrencyPriceAverage *Float `xmlrpc:"user_currency_price_average,omitempty"` + UserCurrencyPriceTotal *Float `xmlrpc:"user_currency_price_total,omitempty"` + UserCurrencyResidual *Float `xmlrpc:"user_currency_residual,omitempty"` + UserId *Many2One `xmlrpc:"user_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) { + return c.Create(AccountInvoiceReportModel, air) +} + +// 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) +} + +// 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 + } + if airs != nil && len(*airs) > 0 { + return &((*airs)[0]), nil + } + return nil, fmt.Errorf("id %v of account.invoice.report not found", id) +} + +// 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 + } + if airs != nil && len(*airs) > 0 { + return &((*airs)[0]), nil + } + return nil, fmt.Errorf("no account.invoice.report was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(AccountInvoiceReportModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.invoice.report was found with criteria %v and options %v", criteria, options) +} diff --git a/account_invoice_tax.go b/account_invoice_tax.go new file mode 100644 index 00000000..dcb05634 --- /dev/null +++ b/account_invoice_tax.go @@ -0,0 +1,131 @@ +package odoo + +import ( + "fmt" +) + +// AccountInvoiceTax represents account.invoice.tax model. +type AccountInvoiceTax struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AccountAnalyticId *Many2One `xmlrpc:"account_analytic_id,omitempty"` + AccountId *Many2One `xmlrpc:"account_id,omitempty"` + Amount *Float `xmlrpc:"amount,omitempty"` + AmountRounding *Float `xmlrpc:"amount_rounding,omitempty"` + AmountTotal *Float `xmlrpc:"amount_total,omitempty"` + Base *Float `xmlrpc:"base,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"` + InvoiceId *Many2One `xmlrpc:"invoice_id,omitempty"` + Manual *Bool `xmlrpc:"manual,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + TaxId *Many2One `xmlrpc:"tax_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountInvoiceTaxs represents array of account.invoice.tax model. +type AccountInvoiceTaxs []AccountInvoiceTax + +// AccountInvoiceTaxModel is the odoo model name. +const AccountInvoiceTaxModel = "account.invoice.tax" + +// Many2One convert AccountInvoiceTax to *Many2One. +func (ait *AccountInvoiceTax) Many2One() *Many2One { + return NewMany2One(ait.Id.Get(), "") +} + +// CreateAccountInvoiceTax creates a new account.invoice.tax model and returns its id. +func (c *Client) CreateAccountInvoiceTax(ait *AccountInvoiceTax) (int64, error) { + return c.Create(AccountInvoiceTaxModel, ait) +} + +// UpdateAccountInvoiceTax updates an existing account.invoice.tax record. +func (c *Client) UpdateAccountInvoiceTax(ait *AccountInvoiceTax) error { + return c.UpdateAccountInvoiceTaxs([]int64{ait.Id.Get()}, ait) +} + +// UpdateAccountInvoiceTaxs updates existing account.invoice.tax records. +// All records (represented by ids) will be updated by ait values. +func (c *Client) UpdateAccountInvoiceTaxs(ids []int64, ait *AccountInvoiceTax) error { + return c.Update(AccountInvoiceTaxModel, ids, ait) +} + +// DeleteAccountInvoiceTax deletes an existing account.invoice.tax record. +func (c *Client) DeleteAccountInvoiceTax(id int64) error { + return c.DeleteAccountInvoiceTaxs([]int64{id}) +} + +// DeleteAccountInvoiceTaxs deletes existing account.invoice.tax records. +func (c *Client) DeleteAccountInvoiceTaxs(ids []int64) error { + return c.Delete(AccountInvoiceTaxModel, ids) +} + +// GetAccountInvoiceTax gets account.invoice.tax existing record. +func (c *Client) GetAccountInvoiceTax(id int64) (*AccountInvoiceTax, error) { + aits, err := c.GetAccountInvoiceTaxs([]int64{id}) + if err != nil { + return nil, err + } + if aits != nil && len(*aits) > 0 { + return &((*aits)[0]), nil + } + return nil, fmt.Errorf("id %v of account.invoice.tax not found", id) +} + +// GetAccountInvoiceTaxs gets account.invoice.tax existing records. +func (c *Client) GetAccountInvoiceTaxs(ids []int64) (*AccountInvoiceTaxs, error) { + aits := &AccountInvoiceTaxs{} + if err := c.Read(AccountInvoiceTaxModel, ids, nil, aits); err != nil { + return nil, err + } + return aits, nil +} + +// FindAccountInvoiceTax finds account.invoice.tax record by querying it with criteria. +func (c *Client) FindAccountInvoiceTax(criteria *Criteria) (*AccountInvoiceTax, error) { + aits := &AccountInvoiceTaxs{} + if err := c.SearchRead(AccountInvoiceTaxModel, criteria, NewOptions().Limit(1), aits); err != nil { + return nil, err + } + if aits != nil && len(*aits) > 0 { + return &((*aits)[0]), nil + } + return nil, fmt.Errorf("no account.invoice.tax was found with criteria %v", criteria) +} + +// FindAccountInvoiceTaxs finds account.invoice.tax records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountInvoiceTaxs(criteria *Criteria, options *Options) (*AccountInvoiceTaxs, error) { + aits := &AccountInvoiceTaxs{} + if err := c.SearchRead(AccountInvoiceTaxModel, criteria, options, aits); err != nil { + return nil, err + } + return aits, nil +} + +// FindAccountInvoiceTaxIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountInvoiceTaxIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(AccountInvoiceTaxModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindAccountInvoiceTaxId finds record id by querying it with criteria. +func (c *Client) FindAccountInvoiceTaxId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountInvoiceTaxModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.invoice.tax was found with criteria %v and options %v", criteria, options) +} diff --git a/account_journal.go b/account_journal.go index 65fe2604..dfbd5bc8 100644 --- a/account_journal.go +++ b/account_journal.go @@ -6,47 +6,47 @@ import ( // AccountJournal represents account.journal model. type AccountJournal struct { - LastUpdate *Time `xmlrpc:"__last_update,omptempty"` - AccountControlIds *Relation `xmlrpc:"account_control_ids,omptempty"` - AccountSetupBankDataDone *Bool `xmlrpc:"account_setup_bank_data_done,omptempty"` - Active *Bool `xmlrpc:"active,omptempty"` - AtLeastOneInbound *Bool `xmlrpc:"at_least_one_inbound,omptempty"` - AtLeastOneOutbound *Bool `xmlrpc:"at_least_one_outbound,omptempty"` - BankAccNumber *String `xmlrpc:"bank_acc_number,omptempty"` - BankAccountId *Many2One `xmlrpc:"bank_account_id,omptempty"` - BankId *Many2One `xmlrpc:"bank_id,omptempty"` - BankStatementsSource *Selection `xmlrpc:"bank_statements_source,omptempty"` - BelongsToCompany *Bool `xmlrpc:"belongs_to_company,omptempty"` - Code *String `xmlrpc:"code,omptempty"` - Color *Int `xmlrpc:"color,omptempty"` - CompanyId *Many2One `xmlrpc:"company_id,omptempty"` - CreateDate *Time `xmlrpc:"create_date,omptempty"` - CreateUid *Many2One `xmlrpc:"create_uid,omptempty"` - CurrencyId *Many2One `xmlrpc:"currency_id,omptempty"` - DefaultCreditAccountId *Many2One `xmlrpc:"default_credit_account_id,omptempty"` - DefaultDebitAccountId *Many2One `xmlrpc:"default_debit_account_id,omptempty"` - DisplayName *String `xmlrpc:"display_name,omptempty"` - GroupInvoiceLines *Bool `xmlrpc:"group_invoice_lines,omptempty"` - Id *Int `xmlrpc:"id,omptempty"` - InboundPaymentMethodIds *Relation `xmlrpc:"inbound_payment_method_ids,omptempty"` - KanbanDashboard *String `xmlrpc:"kanban_dashboard,omptempty"` - KanbanDashboardGraph *String `xmlrpc:"kanban_dashboard_graph,omptempty"` - LossAccountId *Many2One `xmlrpc:"loss_account_id,omptempty"` - Name *String `xmlrpc:"name,omptempty"` - OutboundPaymentMethodIds *Relation `xmlrpc:"outbound_payment_method_ids,omptempty"` - ProfitAccountId *Many2One `xmlrpc:"profit_account_id,omptempty"` - RefundSequence *Bool `xmlrpc:"refund_sequence,omptempty"` - RefundSequenceId *Many2One `xmlrpc:"refund_sequence_id,omptempty"` - RefundSequenceNumberNext *Int `xmlrpc:"refund_sequence_number_next,omptempty"` - Sequence *Int `xmlrpc:"sequence,omptempty"` - SequenceId *Many2One `xmlrpc:"sequence_id,omptempty"` - SequenceNumberNext *Int `xmlrpc:"sequence_number_next,omptempty"` - ShowOnDashboard *Bool `xmlrpc:"show_on_dashboard,omptempty"` - Type *Selection `xmlrpc:"type,omptempty"` - TypeControlIds *Relation `xmlrpc:"type_control_ids,omptempty"` - UpdatePosted *Bool `xmlrpc:"update_posted,omptempty"` - WriteDate *Time `xmlrpc:"write_date,omptempty"` - WriteUid *Many2One `xmlrpc:"write_uid,omptempty"` + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AccountControlIds *Relation `xmlrpc:"account_control_ids,omitempty"` + AccountSetupBankDataDone *Bool `xmlrpc:"account_setup_bank_data_done,omitempty"` + Active *Bool `xmlrpc:"active,omitempty"` + AtLeastOneInbound *Bool `xmlrpc:"at_least_one_inbound,omitempty"` + AtLeastOneOutbound *Bool `xmlrpc:"at_least_one_outbound,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"` + BelongsToCompany *Bool `xmlrpc:"belongs_to_company,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"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + DefaultCreditAccountId *Many2One `xmlrpc:"default_credit_account_id,omitempty"` + DefaultDebitAccountId *Many2One `xmlrpc:"default_debit_account_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + GroupInvoiceLines *Bool `xmlrpc:"group_invoice_lines,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + InboundPaymentMethodIds *Relation `xmlrpc:"inbound_payment_method_ids,omitempty"` + KanbanDashboard *String `xmlrpc:"kanban_dashboard,omitempty"` + KanbanDashboardGraph *String `xmlrpc:"kanban_dashboard_graph,omitempty"` + LossAccountId *Many2One `xmlrpc:"loss_account_id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + OutboundPaymentMethodIds *Relation `xmlrpc:"outbound_payment_method_ids,omitempty"` + ProfitAccountId *Many2One `xmlrpc:"profit_account_id,omitempty"` + RefundSequence *Bool `xmlrpc:"refund_sequence,omitempty"` + RefundSequenceId *Many2One `xmlrpc:"refund_sequence_id,omitempty"` + RefundSequenceNumberNext *Int `xmlrpc:"refund_sequence_number_next,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + SequenceId *Many2One `xmlrpc:"sequence_id,omitempty"` + SequenceNumberNext *Int `xmlrpc:"sequence_number_next,omitempty"` + ShowOnDashboard *Bool `xmlrpc:"show_on_dashboard,omitempty"` + Type *Selection `xmlrpc:"type,omitempty"` + TypeControlIds *Relation `xmlrpc:"type_control_ids,omitempty"` + UpdatePosted *Bool `xmlrpc:"update_posted,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` } // AccountJournals represents array of account.journal model. @@ -116,7 +116,7 @@ func (c *Client) FindAccountJournal(criteria *Criteria) (*AccountJournal, error) if ajs != nil && len(*ajs) > 0 { return &((*ajs)[0]), nil } - return nil, fmt.Errorf("account.journal was not found") + return nil, fmt.Errorf("no account.journal was found with criteria %v", criteria) } // FindAccountJournals finds account.journal records by querying it @@ -148,5 +148,5 @@ func (c *Client) FindAccountJournalId(criteria *Criteria, options *Options) (int if len(ids) > 0 { return ids[0], nil } - return -1, fmt.Errorf("account.journal was not found") + return -1, fmt.Errorf("no account.journal was found with criteria %v and options %v", criteria, options) } diff --git a/account_move.go b/account_move.go new file mode 100644 index 00000000..c103574a --- /dev/null +++ b/account_move.go @@ -0,0 +1,133 @@ +package odoo + +import ( + "fmt" +) + +// AccountMove represents account.move model. +type AccountMove struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + DummyAccountId *Many2One `xmlrpc:"dummy_account_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + JournalId *Many2One `xmlrpc:"journal_id,omitempty"` + LineIds *Relation `xmlrpc:"line_ids,omitempty"` + MatchedPercentage *Float `xmlrpc:"matched_percentage,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Narration *String `xmlrpc:"narration,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + Ref *String `xmlrpc:"ref,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + StockMoveId *Many2One `xmlrpc:"stock_move_id,omitempty"` + TaxCashBasisRecId *Many2One `xmlrpc:"tax_cash_basis_rec_id,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) { + return c.Create(AccountMoveModel, am) +} + +// 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) +} + +// 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 + } + if ams != nil && len(*ams) > 0 { + return &((*ams)[0]), nil + } + return nil, fmt.Errorf("id %v of account.move not found", id) +} + +// 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 + } + if ams != nil && len(*ams) > 0 { + return &((*ams)[0]), nil + } + return nil, fmt.Errorf("no account.move was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(AccountMoveModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.move was found with criteria %v and options %v", criteria, options) +} diff --git a/account_move_line.go b/account_move_line.go new file mode 100644 index 00000000..b3de6df8 --- /dev/null +++ b/account_move_line.go @@ -0,0 +1,162 @@ +package odoo + +import ( + "fmt" +) + +// AccountMoveLine represents account.move.line model. +type AccountMoveLine struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AccountId *Many2One `xmlrpc:"account_id,omitempty"` + AmountCurrency *Float `xmlrpc:"amount_currency,omitempty"` + AmountResidual *Float `xmlrpc:"amount_residual,omitempty"` + AmountResidualCurrency *Float `xmlrpc:"amount_residual_currency,omitempty"` + AnalyticAccountId *Many2One `xmlrpc:"analytic_account_id,omitempty"` + AnalyticLineIds *Relation `xmlrpc:"analytic_line_ids,omitempty"` + AnalyticTagIds *Relation `xmlrpc:"analytic_tag_ids,omitempty"` + Balance *Float `xmlrpc:"balance,omitempty"` + BalanceCashBasis *Float `xmlrpc:"balance_cash_basis,omitempty"` + Blocked *Bool `xmlrpc:"blocked,omitempty"` + CompanyCurrencyId *Many2One `xmlrpc:"company_currency_id,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + Counterpart *String `xmlrpc:"counterpart,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Credit *Float `xmlrpc:"credit,omitempty"` + CreditCashBasis *Float `xmlrpc:"credit_cash_basis,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + Date *Time `xmlrpc:"date,omitempty"` + DateMaturity *Time `xmlrpc:"date_maturity,omitempty"` + Debit *Float `xmlrpc:"debit,omitempty"` + DebitCashBasis *Float `xmlrpc:"debit_cash_basis,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + FullReconcileId *Many2One `xmlrpc:"full_reconcile_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + InvoiceId *Many2One `xmlrpc:"invoice_id,omitempty"` + IsUnaffectedEarningsLine *Bool `xmlrpc:"is_unaffected_earnings_line,omitempty"` + JournalId *Many2One `xmlrpc:"journal_id,omitempty"` + MatchedCreditIds *Relation `xmlrpc:"matched_credit_ids,omitempty"` + MatchedDebitIds *Relation `xmlrpc:"matched_debit_ids,omitempty"` + MoveId *Many2One `xmlrpc:"move_id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Narration *String `xmlrpc:"narration,omitempty"` + ParentState *String `xmlrpc:"parent_state,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PaymentId *Many2One `xmlrpc:"payment_id,omitempty"` + ProductId *Many2One `xmlrpc:"product_id,omitempty"` + ProductUomId *Many2One `xmlrpc:"product_uom_id,omitempty"` + Quantity *Float `xmlrpc:"quantity,omitempty"` + Reconciled *Bool `xmlrpc:"reconciled,omitempty"` + Ref *String `xmlrpc:"ref,omitempty"` + StatementId *Many2One `xmlrpc:"statement_id,omitempty"` + StatementLineId *Many2One `xmlrpc:"statement_line_id,omitempty"` + TaxBaseAmount *Float `xmlrpc:"tax_base_amount,omitempty"` + TaxExigible *Bool `xmlrpc:"tax_exigible,omitempty"` + TaxIds *Relation `xmlrpc:"tax_ids,omitempty"` + TaxLineId *Many2One `xmlrpc:"tax_line_id,omitempty"` + UserTypeId *Many2One `xmlrpc:"user_type_id,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) { + return c.Create(AccountMoveLineModel, aml) +} + +// 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) +} + +// 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 + } + if amls != nil && len(*amls) > 0 { + return &((*amls)[0]), nil + } + return nil, fmt.Errorf("id %v of account.move.line not found", id) +} + +// 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 + } + if amls != nil && len(*amls) > 0 { + return &((*amls)[0]), nil + } + return nil, fmt.Errorf("no account.move.line was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(AccountMoveLineModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.move.line was found with criteria %v and options %v", criteria, options) +} diff --git a/account_move_line_reconcile.go b/account_move_line_reconcile.go new file mode 100644 index 00000000..428d0b07 --- /dev/null +++ b/account_move_line_reconcile.go @@ -0,0 +1,123 @@ +package odoo + +import ( + "fmt" +) + +// AccountMoveLineReconcile represents account.move.line.reconcile model. +type AccountMoveLineReconcile struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Credit *Float `xmlrpc:"credit,omitempty"` + Debit *Float `xmlrpc:"debit,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + TransNbr *Int `xmlrpc:"trans_nbr,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` + Writeoff *Float `xmlrpc:"writeoff,omitempty"` +} + +// AccountMoveLineReconciles represents array of account.move.line.reconcile model. +type AccountMoveLineReconciles []AccountMoveLineReconcile + +// AccountMoveLineReconcileModel is the odoo model name. +const AccountMoveLineReconcileModel = "account.move.line.reconcile" + +// Many2One convert AccountMoveLineReconcile to *Many2One. +func (amlr *AccountMoveLineReconcile) Many2One() *Many2One { + return NewMany2One(amlr.Id.Get(), "") +} + +// CreateAccountMoveLineReconcile creates a new account.move.line.reconcile model and returns its id. +func (c *Client) CreateAccountMoveLineReconcile(amlr *AccountMoveLineReconcile) (int64, error) { + return c.Create(AccountMoveLineReconcileModel, amlr) +} + +// UpdateAccountMoveLineReconcile updates an existing account.move.line.reconcile record. +func (c *Client) UpdateAccountMoveLineReconcile(amlr *AccountMoveLineReconcile) error { + return c.UpdateAccountMoveLineReconciles([]int64{amlr.Id.Get()}, amlr) +} + +// UpdateAccountMoveLineReconciles updates existing account.move.line.reconcile records. +// All records (represented by ids) will be updated by amlr values. +func (c *Client) UpdateAccountMoveLineReconciles(ids []int64, amlr *AccountMoveLineReconcile) error { + return c.Update(AccountMoveLineReconcileModel, ids, amlr) +} + +// DeleteAccountMoveLineReconcile deletes an existing account.move.line.reconcile record. +func (c *Client) DeleteAccountMoveLineReconcile(id int64) error { + return c.DeleteAccountMoveLineReconciles([]int64{id}) +} + +// DeleteAccountMoveLineReconciles deletes existing account.move.line.reconcile records. +func (c *Client) DeleteAccountMoveLineReconciles(ids []int64) error { + return c.Delete(AccountMoveLineReconcileModel, ids) +} + +// GetAccountMoveLineReconcile gets account.move.line.reconcile existing record. +func (c *Client) GetAccountMoveLineReconcile(id int64) (*AccountMoveLineReconcile, error) { + amlrs, err := c.GetAccountMoveLineReconciles([]int64{id}) + if err != nil { + return nil, err + } + if amlrs != nil && len(*amlrs) > 0 { + return &((*amlrs)[0]), nil + } + return nil, fmt.Errorf("id %v of account.move.line.reconcile not found", id) +} + +// GetAccountMoveLineReconciles gets account.move.line.reconcile existing records. +func (c *Client) GetAccountMoveLineReconciles(ids []int64) (*AccountMoveLineReconciles, error) { + amlrs := &AccountMoveLineReconciles{} + if err := c.Read(AccountMoveLineReconcileModel, ids, nil, amlrs); err != nil { + return nil, err + } + return amlrs, nil +} + +// FindAccountMoveLineReconcile finds account.move.line.reconcile record by querying it with criteria. +func (c *Client) FindAccountMoveLineReconcile(criteria *Criteria) (*AccountMoveLineReconcile, error) { + amlrs := &AccountMoveLineReconciles{} + if err := c.SearchRead(AccountMoveLineReconcileModel, criteria, NewOptions().Limit(1), amlrs); err != nil { + return nil, err + } + if amlrs != nil && len(*amlrs) > 0 { + return &((*amlrs)[0]), nil + } + return nil, fmt.Errorf("no account.move.line.reconcile was found with criteria %v", criteria) +} + +// FindAccountMoveLineReconciles finds account.move.line.reconcile records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountMoveLineReconciles(criteria *Criteria, options *Options) (*AccountMoveLineReconciles, error) { + amlrs := &AccountMoveLineReconciles{} + if err := c.SearchRead(AccountMoveLineReconcileModel, criteria, options, amlrs); err != nil { + return nil, err + } + return amlrs, nil +} + +// FindAccountMoveLineReconcileIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountMoveLineReconcileIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(AccountMoveLineReconcileModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindAccountMoveLineReconcileId finds record id by querying it with criteria. +func (c *Client) FindAccountMoveLineReconcileId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountMoveLineReconcileModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.move.line.reconcile was found with criteria %v and options %v", criteria, options) +} diff --git a/account_move_line_reconcile_writeoff.go b/account_move_line_reconcile_writeoff.go new file mode 100644 index 00000000..42aff4c9 --- /dev/null +++ b/account_move_line_reconcile_writeoff.go @@ -0,0 +1,123 @@ +package odoo + +import ( + "fmt" +) + +// AccountMoveLineReconcileWriteoff represents account.move.line.reconcile.writeoff model. +type AccountMoveLineReconcileWriteoff struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AnalyticId *Many2One `xmlrpc:"analytic_id,omitempty"` + Comment *String `xmlrpc:"comment,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DateP *Time `xmlrpc:"date_p,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + JournalId *Many2One `xmlrpc:"journal_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` + WriteoffAccId *Many2One `xmlrpc:"writeoff_acc_id,omitempty"` +} + +// AccountMoveLineReconcileWriteoffs represents array of account.move.line.reconcile.writeoff model. +type AccountMoveLineReconcileWriteoffs []AccountMoveLineReconcileWriteoff + +// AccountMoveLineReconcileWriteoffModel is the odoo model name. +const AccountMoveLineReconcileWriteoffModel = "account.move.line.reconcile.writeoff" + +// Many2One convert AccountMoveLineReconcileWriteoff to *Many2One. +func (amlrw *AccountMoveLineReconcileWriteoff) Many2One() *Many2One { + return NewMany2One(amlrw.Id.Get(), "") +} + +// CreateAccountMoveLineReconcileWriteoff creates a new account.move.line.reconcile.writeoff model and returns its id. +func (c *Client) CreateAccountMoveLineReconcileWriteoff(amlrw *AccountMoveLineReconcileWriteoff) (int64, error) { + return c.Create(AccountMoveLineReconcileWriteoffModel, amlrw) +} + +// UpdateAccountMoveLineReconcileWriteoff updates an existing account.move.line.reconcile.writeoff record. +func (c *Client) UpdateAccountMoveLineReconcileWriteoff(amlrw *AccountMoveLineReconcileWriteoff) error { + return c.UpdateAccountMoveLineReconcileWriteoffs([]int64{amlrw.Id.Get()}, amlrw) +} + +// UpdateAccountMoveLineReconcileWriteoffs updates existing account.move.line.reconcile.writeoff records. +// All records (represented by ids) will be updated by amlrw values. +func (c *Client) UpdateAccountMoveLineReconcileWriteoffs(ids []int64, amlrw *AccountMoveLineReconcileWriteoff) error { + return c.Update(AccountMoveLineReconcileWriteoffModel, ids, amlrw) +} + +// DeleteAccountMoveLineReconcileWriteoff deletes an existing account.move.line.reconcile.writeoff record. +func (c *Client) DeleteAccountMoveLineReconcileWriteoff(id int64) error { + return c.DeleteAccountMoveLineReconcileWriteoffs([]int64{id}) +} + +// DeleteAccountMoveLineReconcileWriteoffs deletes existing account.move.line.reconcile.writeoff records. +func (c *Client) DeleteAccountMoveLineReconcileWriteoffs(ids []int64) error { + return c.Delete(AccountMoveLineReconcileWriteoffModel, ids) +} + +// GetAccountMoveLineReconcileWriteoff gets account.move.line.reconcile.writeoff existing record. +func (c *Client) GetAccountMoveLineReconcileWriteoff(id int64) (*AccountMoveLineReconcileWriteoff, error) { + amlrws, err := c.GetAccountMoveLineReconcileWriteoffs([]int64{id}) + if err != nil { + return nil, err + } + if amlrws != nil && len(*amlrws) > 0 { + return &((*amlrws)[0]), nil + } + return nil, fmt.Errorf("id %v of account.move.line.reconcile.writeoff not found", id) +} + +// GetAccountMoveLineReconcileWriteoffs gets account.move.line.reconcile.writeoff existing records. +func (c *Client) GetAccountMoveLineReconcileWriteoffs(ids []int64) (*AccountMoveLineReconcileWriteoffs, error) { + amlrws := &AccountMoveLineReconcileWriteoffs{} + if err := c.Read(AccountMoveLineReconcileWriteoffModel, ids, nil, amlrws); err != nil { + return nil, err + } + return amlrws, nil +} + +// FindAccountMoveLineReconcileWriteoff finds account.move.line.reconcile.writeoff record by querying it with criteria. +func (c *Client) FindAccountMoveLineReconcileWriteoff(criteria *Criteria) (*AccountMoveLineReconcileWriteoff, error) { + amlrws := &AccountMoveLineReconcileWriteoffs{} + if err := c.SearchRead(AccountMoveLineReconcileWriteoffModel, criteria, NewOptions().Limit(1), amlrws); err != nil { + return nil, err + } + if amlrws != nil && len(*amlrws) > 0 { + return &((*amlrws)[0]), nil + } + return nil, fmt.Errorf("no account.move.line.reconcile.writeoff was found with criteria %v", criteria) +} + +// FindAccountMoveLineReconcileWriteoffs finds account.move.line.reconcile.writeoff records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountMoveLineReconcileWriteoffs(criteria *Criteria, options *Options) (*AccountMoveLineReconcileWriteoffs, error) { + amlrws := &AccountMoveLineReconcileWriteoffs{} + if err := c.SearchRead(AccountMoveLineReconcileWriteoffModel, criteria, options, amlrws); err != nil { + return nil, err + } + return amlrws, nil +} + +// FindAccountMoveLineReconcileWriteoffIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountMoveLineReconcileWriteoffIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(AccountMoveLineReconcileWriteoffModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindAccountMoveLineReconcileWriteoffId finds record id by querying it with criteria. +func (c *Client) FindAccountMoveLineReconcileWriteoffId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountMoveLineReconcileWriteoffModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.move.line.reconcile.writeoff was found with criteria %v and options %v", criteria, options) +} diff --git a/account_move_reversal.go b/account_move_reversal.go new file mode 100644 index 00000000..0fe593e8 --- /dev/null +++ b/account_move_reversal.go @@ -0,0 +1,120 @@ +package odoo + +import ( + "fmt" +) + +// AccountMoveReversal represents account.move.reversal model. +type AccountMoveReversal struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Date *Time `xmlrpc:"date,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + JournalId *Many2One `xmlrpc:"journal_id,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) { + return c.Create(AccountMoveReversalModel, amr) +} + +// 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) +} + +// 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 + } + if amrs != nil && len(*amrs) > 0 { + return &((*amrs)[0]), nil + } + return nil, fmt.Errorf("id %v of account.move.reversal not found", id) +} + +// 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 + } + if amrs != nil && len(*amrs) > 0 { + return &((*amrs)[0]), nil + } + return nil, fmt.Errorf("no account.move.reversal was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(AccountMoveReversalModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.move.reversal was found with criteria %v and options %v", criteria, options) +} diff --git a/account_opening.go b/account_opening.go new file mode 100644 index 00000000..1ff01720 --- /dev/null +++ b/account_opening.go @@ -0,0 +1,124 @@ +package odoo + +import ( + "fmt" +) + +// AccountOpening represents account.opening model. +type AccountOpening struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` + Id *Int `xmlrpc:"id,omitempty"` + JournalId *Many2One `xmlrpc:"journal_id,omitempty"` + OpeningMoveId *Many2One `xmlrpc:"opening_move_id,omitempty"` + OpeningMoveLineIds *Relation `xmlrpc:"opening_move_line_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountOpenings represents array of account.opening model. +type AccountOpenings []AccountOpening + +// AccountOpeningModel is the odoo model name. +const AccountOpeningModel = "account.opening" + +// Many2One convert AccountOpening to *Many2One. +func (ao *AccountOpening) Many2One() *Many2One { + return NewMany2One(ao.Id.Get(), "") +} + +// CreateAccountOpening creates a new account.opening model and returns its id. +func (c *Client) CreateAccountOpening(ao *AccountOpening) (int64, error) { + return c.Create(AccountOpeningModel, ao) +} + +// UpdateAccountOpening updates an existing account.opening record. +func (c *Client) UpdateAccountOpening(ao *AccountOpening) error { + return c.UpdateAccountOpenings([]int64{ao.Id.Get()}, ao) +} + +// UpdateAccountOpenings updates existing account.opening records. +// All records (represented by ids) will be updated by ao values. +func (c *Client) UpdateAccountOpenings(ids []int64, ao *AccountOpening) error { + return c.Update(AccountOpeningModel, ids, ao) +} + +// DeleteAccountOpening deletes an existing account.opening record. +func (c *Client) DeleteAccountOpening(id int64) error { + return c.DeleteAccountOpenings([]int64{id}) +} + +// DeleteAccountOpenings deletes existing account.opening records. +func (c *Client) DeleteAccountOpenings(ids []int64) error { + return c.Delete(AccountOpeningModel, ids) +} + +// GetAccountOpening gets account.opening existing record. +func (c *Client) GetAccountOpening(id int64) (*AccountOpening, error) { + aos, err := c.GetAccountOpenings([]int64{id}) + if err != nil { + return nil, err + } + if aos != nil && len(*aos) > 0 { + return &((*aos)[0]), nil + } + return nil, fmt.Errorf("id %v of account.opening not found", id) +} + +// GetAccountOpenings gets account.opening existing records. +func (c *Client) GetAccountOpenings(ids []int64) (*AccountOpenings, error) { + aos := &AccountOpenings{} + if err := c.Read(AccountOpeningModel, ids, nil, aos); err != nil { + return nil, err + } + return aos, nil +} + +// FindAccountOpening finds account.opening record by querying it with criteria. +func (c *Client) FindAccountOpening(criteria *Criteria) (*AccountOpening, error) { + aos := &AccountOpenings{} + if err := c.SearchRead(AccountOpeningModel, criteria, NewOptions().Limit(1), aos); err != nil { + return nil, err + } + if aos != nil && len(*aos) > 0 { + return &((*aos)[0]), nil + } + return nil, fmt.Errorf("no account.opening was found with criteria %v", criteria) +} + +// FindAccountOpenings finds account.opening records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountOpenings(criteria *Criteria, options *Options) (*AccountOpenings, error) { + aos := &AccountOpenings{} + if err := c.SearchRead(AccountOpeningModel, criteria, options, aos); err != nil { + return nil, err + } + return aos, nil +} + +// FindAccountOpeningIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountOpeningIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(AccountOpeningModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindAccountOpeningId finds record id by querying it with criteria. +func (c *Client) FindAccountOpeningId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountOpeningModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.opening was found with criteria %v and options %v", criteria, options) +} diff --git a/account_partial_reconcile.go b/account_partial_reconcile.go new file mode 100644 index 00000000..227b21f2 --- /dev/null +++ b/account_partial_reconcile.go @@ -0,0 +1,127 @@ +package odoo + +import ( + "fmt" +) + +// AccountPartialReconcile represents account.partial.reconcile model. +type AccountPartialReconcile struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + Amount *Float `xmlrpc:"amount,omitempty"` + AmountCurrency *Float `xmlrpc:"amount_currency,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"` + CreditMoveId *Many2One `xmlrpc:"credit_move_id,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + DebitMoveId *Many2One `xmlrpc:"debit_move_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,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) { + return c.Create(AccountPartialReconcileModel, apr) +} + +// 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) +} + +// 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 + } + if aprs != nil && len(*aprs) > 0 { + return &((*aprs)[0]), nil + } + return nil, fmt.Errorf("id %v of account.partial.reconcile not found", id) +} + +// 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 + } + if aprs != nil && len(*aprs) > 0 { + return &((*aprs)[0]), nil + } + return nil, fmt.Errorf("no account.partial.reconcile was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(AccountPartialReconcileModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.partial.reconcile was found with criteria %v and options %v", criteria, options) +} diff --git a/account_payment.go b/account_payment.go new file mode 100644 index 00000000..a03f2fae --- /dev/null +++ b/account_payment.go @@ -0,0 +1,157 @@ +package odoo + +import ( + "fmt" +) + +// AccountPayment represents account.payment model. +type AccountPayment struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + Amount *Float `xmlrpc:"amount,omitempty"` + Communication *String `xmlrpc:"communication,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"` + DestinationAccountId *Many2One `xmlrpc:"destination_account_id,omitempty"` + DestinationJournalId *Many2One `xmlrpc:"destination_journal_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + HasInvoices *Bool `xmlrpc:"has_invoices,omitempty"` + HidePaymentMethod *Bool `xmlrpc:"hide_payment_method,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + InvoiceIds *Relation `xmlrpc:"invoice_ids,omitempty"` + JournalId *Many2One `xmlrpc:"journal_id,omitempty"` + MessageChannelIds *Relation `xmlrpc:"message_channel_ids,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageLastPost *Time `xmlrpc:"message_last_post,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MessageUnread *Bool `xmlrpc:"message_unread,omitempty"` + MessageUnreadCounter *Int `xmlrpc:"message_unread_counter,omitempty"` + MoveLineIds *Relation `xmlrpc:"move_line_ids,omitempty"` + MoveName *String `xmlrpc:"move_name,omitempty"` + MoveReconciled *Bool `xmlrpc:"move_reconciled,omitempty"` + Name *String `xmlrpc:"name,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"` + PaymentMethodId *Many2One `xmlrpc:"payment_method_id,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"` + State *Selection `xmlrpc:"state,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` + WriteoffAccountId *Many2One `xmlrpc:"writeoff_account_id,omitempty"` + WriteoffLabel *String `xmlrpc:"writeoff_label,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) { + return c.Create(AccountPaymentModel, ap) +} + +// 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) +} + +// 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 + } + if aps != nil && len(*aps) > 0 { + return &((*aps)[0]), nil + } + return nil, fmt.Errorf("id %v of account.payment not found", id) +} + +// 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 + } + if aps != nil && len(*aps) > 0 { + return &((*aps)[0]), nil + } + return nil, fmt.Errorf("no account.payment was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(AccountPaymentModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.payment was found with criteria %v and options %v", criteria, options) +} diff --git a/account_payment_method.go b/account_payment_method.go new file mode 100644 index 00000000..fc3d7275 --- /dev/null +++ b/account_payment_method.go @@ -0,0 +1,121 @@ +package odoo + +import ( + "fmt" +) + +// AccountPaymentMethod represents account.payment.method model. +type AccountPaymentMethod struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` + 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) { + return c.Create(AccountPaymentMethodModel, apm) +} + +// 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) +} + +// 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 + } + if apms != nil && len(*apms) > 0 { + return &((*apms)[0]), nil + } + return nil, fmt.Errorf("id %v of account.payment.method not found", id) +} + +// 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 + } + if apms != nil && len(*apms) > 0 { + return &((*apms)[0]), nil + } + return nil, fmt.Errorf("no account.payment.method was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(AccountPaymentMethodModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.payment.method was found with criteria %v and options %v", criteria, options) +} diff --git a/account_payment_term.go b/account_payment_term.go new file mode 100644 index 00000000..06aabb10 --- /dev/null +++ b/account_payment_term.go @@ -0,0 +1,124 @@ +package odoo + +import ( + "fmt" +) + +// AccountPaymentTerm represents account.payment.term model. +type AccountPaymentTerm struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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"` + 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) { + return c.Create(AccountPaymentTermModel, apt) +} + +// 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) +} + +// 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 + } + if apts != nil && len(*apts) > 0 { + return &((*apts)[0]), nil + } + return nil, fmt.Errorf("id %v of account.payment.term not found", id) +} + +// 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 + } + if apts != nil && len(*apts) > 0 { + return &((*apts)[0]), nil + } + return nil, fmt.Errorf("no account.payment.term was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(AccountPaymentTermModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.payment.term was found with criteria %v and options %v", criteria, options) +} diff --git a/account_payment_term_line.go b/account_payment_term_line.go new file mode 100644 index 00000000..8f0f8662 --- /dev/null +++ b/account_payment_term_line.go @@ -0,0 +1,124 @@ +package odoo + +import ( + "fmt" +) + +// AccountPaymentTermLine represents account.payment.term.line model. +type AccountPaymentTermLine struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Days *Int `xmlrpc:"days,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Option *Selection `xmlrpc:"option,omitempty"` + PaymentId *Many2One `xmlrpc:"payment_id,omitempty"` + Sequence *Int `xmlrpc:"sequence,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) { + return c.Create(AccountPaymentTermLineModel, aptl) +} + +// 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) +} + +// 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 + } + if aptls != nil && len(*aptls) > 0 { + return &((*aptls)[0]), nil + } + return nil, fmt.Errorf("id %v of account.payment.term.line not found", id) +} + +// 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 + } + if aptls != nil && len(*aptls) > 0 { + return &((*aptls)[0]), nil + } + return nil, fmt.Errorf("no account.payment.term.line was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(AccountPaymentTermLineModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.payment.term.line was found with criteria %v and options %v", criteria, options) +} diff --git a/account_print_journal.go b/account_print_journal.go new file mode 100644 index 00000000..56484699 --- /dev/null +++ b/account_print_journal.go @@ -0,0 +1,125 @@ +package odoo + +import ( + "fmt" +) + +// AccountPrintJournal represents account.print.journal model. +type AccountPrintJournal struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AmountCurrency *Bool `xmlrpc:"amount_currency,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"` + Id *Int `xmlrpc:"id,omitempty"` + JournalIds *Relation `xmlrpc:"journal_ids,omitempty"` + SortSelection *Selection `xmlrpc:"sort_selection,omitempty"` + TargetMove *Selection `xmlrpc:"target_move,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountPrintJournals represents array of account.print.journal model. +type AccountPrintJournals []AccountPrintJournal + +// AccountPrintJournalModel is the odoo model name. +const AccountPrintJournalModel = "account.print.journal" + +// Many2One convert AccountPrintJournal to *Many2One. +func (apj *AccountPrintJournal) Many2One() *Many2One { + return NewMany2One(apj.Id.Get(), "") +} + +// CreateAccountPrintJournal creates a new account.print.journal model and returns its id. +func (c *Client) CreateAccountPrintJournal(apj *AccountPrintJournal) (int64, error) { + return c.Create(AccountPrintJournalModel, apj) +} + +// UpdateAccountPrintJournal updates an existing account.print.journal record. +func (c *Client) UpdateAccountPrintJournal(apj *AccountPrintJournal) error { + return c.UpdateAccountPrintJournals([]int64{apj.Id.Get()}, apj) +} + +// UpdateAccountPrintJournals updates existing account.print.journal records. +// All records (represented by ids) will be updated by apj values. +func (c *Client) UpdateAccountPrintJournals(ids []int64, apj *AccountPrintJournal) error { + return c.Update(AccountPrintJournalModel, ids, apj) +} + +// DeleteAccountPrintJournal deletes an existing account.print.journal record. +func (c *Client) DeleteAccountPrintJournal(id int64) error { + return c.DeleteAccountPrintJournals([]int64{id}) +} + +// DeleteAccountPrintJournals deletes existing account.print.journal records. +func (c *Client) DeleteAccountPrintJournals(ids []int64) error { + return c.Delete(AccountPrintJournalModel, ids) +} + +// GetAccountPrintJournal gets account.print.journal existing record. +func (c *Client) GetAccountPrintJournal(id int64) (*AccountPrintJournal, error) { + apjs, err := c.GetAccountPrintJournals([]int64{id}) + if err != nil { + return nil, err + } + if apjs != nil && len(*apjs) > 0 { + return &((*apjs)[0]), nil + } + return nil, fmt.Errorf("id %v of account.print.journal not found", id) +} + +// GetAccountPrintJournals gets account.print.journal existing records. +func (c *Client) GetAccountPrintJournals(ids []int64) (*AccountPrintJournals, error) { + apjs := &AccountPrintJournals{} + if err := c.Read(AccountPrintJournalModel, ids, nil, apjs); err != nil { + return nil, err + } + return apjs, nil +} + +// FindAccountPrintJournal finds account.print.journal record by querying it with criteria. +func (c *Client) FindAccountPrintJournal(criteria *Criteria) (*AccountPrintJournal, error) { + apjs := &AccountPrintJournals{} + if err := c.SearchRead(AccountPrintJournalModel, criteria, NewOptions().Limit(1), apjs); err != nil { + return nil, err + } + if apjs != nil && len(*apjs) > 0 { + return &((*apjs)[0]), nil + } + return nil, fmt.Errorf("no account.print.journal was found with criteria %v", criteria) +} + +// FindAccountPrintJournals finds account.print.journal records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountPrintJournals(criteria *Criteria, options *Options) (*AccountPrintJournals, error) { + apjs := &AccountPrintJournals{} + if err := c.SearchRead(AccountPrintJournalModel, criteria, options, apjs); err != nil { + return nil, err + } + return apjs, nil +} + +// FindAccountPrintJournalIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountPrintJournalIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(AccountPrintJournalModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindAccountPrintJournalId finds record id by querying it with criteria. +func (c *Client) FindAccountPrintJournalId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountPrintJournalModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.print.journal was found with criteria %v and options %v", criteria, options) +} diff --git a/account_reconcile_model.go b/account_reconcile_model.go new file mode 100644 index 00000000..4d9690fb --- /dev/null +++ b/account_reconcile_model.go @@ -0,0 +1,136 @@ +package odoo + +import ( + "fmt" +) + +// AccountReconcileModel represents account.reconcile.model model. +type AccountReconcileModel struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AccountId *Many2One `xmlrpc:"account_id,omitempty"` + Amount *Float `xmlrpc:"amount,omitempty"` + AmountType *Selection `xmlrpc:"amount_type,omitempty"` + AnalyticAccountId *Many2One `xmlrpc:"analytic_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"` + HasSecondLine *Bool `xmlrpc:"has_second_line,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + JournalId *Many2One `xmlrpc:"journal_id,omitempty"` + Label *String `xmlrpc:"label,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + SecondAccountId *Many2One `xmlrpc:"second_account_id,omitempty"` + SecondAmount *Float `xmlrpc:"second_amount,omitempty"` + SecondAmountType *Selection `xmlrpc:"second_amount_type,omitempty"` + SecondAnalyticAccountId *Many2One `xmlrpc:"second_analytic_account_id,omitempty"` + SecondJournalId *Many2One `xmlrpc:"second_journal_id,omitempty"` + SecondLabel *String `xmlrpc:"second_label,omitempty"` + SecondTaxId *Many2One `xmlrpc:"second_tax_id,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + TaxId *Many2One `xmlrpc:"tax_id,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) { + return c.Create(AccountReconcileModelModel, arm) +} + +// 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) +} + +// 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 + } + if arms != nil && len(*arms) > 0 { + return &((*arms)[0]), nil + } + return nil, fmt.Errorf("id %v of account.reconcile.model not found", id) +} + +// 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 + } + if arms != nil && len(*arms) > 0 { + return &((*arms)[0]), nil + } + return nil, fmt.Errorf("no account.reconcile.model was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(AccountReconcileModelModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.reconcile.model was found with criteria %v and options %v", criteria, options) +} diff --git a/account_reconcile_model_template.go b/account_reconcile_model_template.go new file mode 100644 index 00000000..355b57fa --- /dev/null +++ b/account_reconcile_model_template.go @@ -0,0 +1,132 @@ +package odoo + +import ( + "fmt" +) + +// AccountReconcileModelTemplate represents account.reconcile.model.template model. +type AccountReconcileModelTemplate struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AccountId *Many2One `xmlrpc:"account_id,omitempty"` + Amount *Float `xmlrpc:"amount,omitempty"` + AmountType *Selection `xmlrpc:"amount_type,omitempty"` + ChartTemplateId *Many2One `xmlrpc:"chart_template_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + HasSecondLine *Bool `xmlrpc:"has_second_line,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Label *String `xmlrpc:"label,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + SecondAccountId *Many2One `xmlrpc:"second_account_id,omitempty"` + SecondAmount *Float `xmlrpc:"second_amount,omitempty"` + SecondAmountType *Selection `xmlrpc:"second_amount_type,omitempty"` + SecondLabel *String `xmlrpc:"second_label,omitempty"` + SecondTaxId *Many2One `xmlrpc:"second_tax_id,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + TaxId *Many2One `xmlrpc:"tax_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountReconcileModelTemplates represents array of account.reconcile.model.template model. +type AccountReconcileModelTemplates []AccountReconcileModelTemplate + +// AccountReconcileModelTemplateModel is the odoo model name. +const AccountReconcileModelTemplateModel = "account.reconcile.model.template" + +// Many2One convert AccountReconcileModelTemplate to *Many2One. +func (armt *AccountReconcileModelTemplate) Many2One() *Many2One { + return NewMany2One(armt.Id.Get(), "") +} + +// CreateAccountReconcileModelTemplate creates a new account.reconcile.model.template model and returns its id. +func (c *Client) CreateAccountReconcileModelTemplate(armt *AccountReconcileModelTemplate) (int64, error) { + return c.Create(AccountReconcileModelTemplateModel, armt) +} + +// UpdateAccountReconcileModelTemplate updates an existing account.reconcile.model.template record. +func (c *Client) UpdateAccountReconcileModelTemplate(armt *AccountReconcileModelTemplate) error { + return c.UpdateAccountReconcileModelTemplates([]int64{armt.Id.Get()}, armt) +} + +// UpdateAccountReconcileModelTemplates updates existing account.reconcile.model.template records. +// All records (represented by ids) will be updated by armt values. +func (c *Client) UpdateAccountReconcileModelTemplates(ids []int64, armt *AccountReconcileModelTemplate) error { + return c.Update(AccountReconcileModelTemplateModel, ids, armt) +} + +// DeleteAccountReconcileModelTemplate deletes an existing account.reconcile.model.template record. +func (c *Client) DeleteAccountReconcileModelTemplate(id int64) error { + return c.DeleteAccountReconcileModelTemplates([]int64{id}) +} + +// DeleteAccountReconcileModelTemplates deletes existing account.reconcile.model.template records. +func (c *Client) DeleteAccountReconcileModelTemplates(ids []int64) error { + return c.Delete(AccountReconcileModelTemplateModel, ids) +} + +// GetAccountReconcileModelTemplate gets account.reconcile.model.template existing record. +func (c *Client) GetAccountReconcileModelTemplate(id int64) (*AccountReconcileModelTemplate, error) { + armts, err := c.GetAccountReconcileModelTemplates([]int64{id}) + if err != nil { + return nil, err + } + if armts != nil && len(*armts) > 0 { + return &((*armts)[0]), nil + } + return nil, fmt.Errorf("id %v of account.reconcile.model.template not found", id) +} + +// GetAccountReconcileModelTemplates gets account.reconcile.model.template existing records. +func (c *Client) GetAccountReconcileModelTemplates(ids []int64) (*AccountReconcileModelTemplates, error) { + armts := &AccountReconcileModelTemplates{} + if err := c.Read(AccountReconcileModelTemplateModel, ids, nil, armts); err != nil { + return nil, err + } + return armts, nil +} + +// FindAccountReconcileModelTemplate finds account.reconcile.model.template record by querying it with criteria. +func (c *Client) FindAccountReconcileModelTemplate(criteria *Criteria) (*AccountReconcileModelTemplate, error) { + armts := &AccountReconcileModelTemplates{} + if err := c.SearchRead(AccountReconcileModelTemplateModel, criteria, NewOptions().Limit(1), armts); err != nil { + return nil, err + } + if armts != nil && len(*armts) > 0 { + return &((*armts)[0]), nil + } + return nil, fmt.Errorf("no account.reconcile.model.template was found with criteria %v", criteria) +} + +// FindAccountReconcileModelTemplates finds account.reconcile.model.template records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountReconcileModelTemplates(criteria *Criteria, options *Options) (*AccountReconcileModelTemplates, error) { + armts := &AccountReconcileModelTemplates{} + if err := c.SearchRead(AccountReconcileModelTemplateModel, criteria, options, armts); err != nil { + return nil, err + } + return armts, nil +} + +// FindAccountReconcileModelTemplateIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountReconcileModelTemplateIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(AccountReconcileModelTemplateModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindAccountReconcileModelTemplateId finds record id by querying it with criteria. +func (c *Client) FindAccountReconcileModelTemplateId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountReconcileModelTemplateModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.reconcile.model.template was found with criteria %v and options %v", criteria, options) +} diff --git a/account_register_payments.go b/account_register_payments.go new file mode 100644 index 00000000..849f4a97 --- /dev/null +++ b/account_register_payments.go @@ -0,0 +1,132 @@ +package odoo + +import ( + "fmt" +) + +// AccountRegisterPayments represents account.register.payments model. +type AccountRegisterPayments struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + Amount *Float `xmlrpc:"amount,omitempty"` + Communication *String `xmlrpc:"communication,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"` + HidePaymentMethod *Bool `xmlrpc:"hide_payment_method,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + InvoiceIds *Relation `xmlrpc:"invoice_ids,omitempty"` + JournalId *Many2One `xmlrpc:"journal_id,omitempty"` + Multi *Bool `xmlrpc:"multi,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PartnerType *Selection `xmlrpc:"partner_type,omitempty"` + PaymentDate *Time `xmlrpc:"payment_date,omitempty"` + PaymentMethodCode *String `xmlrpc:"payment_method_code,omitempty"` + PaymentMethodId *Many2One `xmlrpc:"payment_method_id,omitempty"` + PaymentType *Selection `xmlrpc:"payment_type,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountRegisterPaymentss represents array of account.register.payments model. +type AccountRegisterPaymentss []AccountRegisterPayments + +// AccountRegisterPaymentsModel is the odoo model name. +const AccountRegisterPaymentsModel = "account.register.payments" + +// Many2One convert AccountRegisterPayments to *Many2One. +func (arp *AccountRegisterPayments) Many2One() *Many2One { + return NewMany2One(arp.Id.Get(), "") +} + +// CreateAccountRegisterPayments creates a new account.register.payments model and returns its id. +func (c *Client) CreateAccountRegisterPayments(arp *AccountRegisterPayments) (int64, error) { + return c.Create(AccountRegisterPaymentsModel, arp) +} + +// UpdateAccountRegisterPayments updates an existing account.register.payments record. +func (c *Client) UpdateAccountRegisterPayments(arp *AccountRegisterPayments) error { + return c.UpdateAccountRegisterPaymentss([]int64{arp.Id.Get()}, arp) +} + +// UpdateAccountRegisterPaymentss updates existing account.register.payments records. +// All records (represented by ids) will be updated by arp values. +func (c *Client) UpdateAccountRegisterPaymentss(ids []int64, arp *AccountRegisterPayments) error { + return c.Update(AccountRegisterPaymentsModel, ids, arp) +} + +// DeleteAccountRegisterPayments deletes an existing account.register.payments record. +func (c *Client) DeleteAccountRegisterPayments(id int64) error { + return c.DeleteAccountRegisterPaymentss([]int64{id}) +} + +// DeleteAccountRegisterPaymentss deletes existing account.register.payments records. +func (c *Client) DeleteAccountRegisterPaymentss(ids []int64) error { + return c.Delete(AccountRegisterPaymentsModel, ids) +} + +// GetAccountRegisterPayments gets account.register.payments existing record. +func (c *Client) GetAccountRegisterPayments(id int64) (*AccountRegisterPayments, error) { + arps, err := c.GetAccountRegisterPaymentss([]int64{id}) + if err != nil { + return nil, err + } + if arps != nil && len(*arps) > 0 { + return &((*arps)[0]), nil + } + return nil, fmt.Errorf("id %v of account.register.payments not found", id) +} + +// GetAccountRegisterPaymentss gets account.register.payments existing records. +func (c *Client) GetAccountRegisterPaymentss(ids []int64) (*AccountRegisterPaymentss, error) { + arps := &AccountRegisterPaymentss{} + if err := c.Read(AccountRegisterPaymentsModel, ids, nil, arps); err != nil { + return nil, err + } + return arps, nil +} + +// FindAccountRegisterPayments finds account.register.payments record by querying it with criteria. +func (c *Client) FindAccountRegisterPayments(criteria *Criteria) (*AccountRegisterPayments, error) { + arps := &AccountRegisterPaymentss{} + if err := c.SearchRead(AccountRegisterPaymentsModel, criteria, NewOptions().Limit(1), arps); err != nil { + return nil, err + } + if arps != nil && len(*arps) > 0 { + return &((*arps)[0]), nil + } + return nil, fmt.Errorf("no account.register.payments was found with criteria %v", criteria) +} + +// FindAccountRegisterPaymentss finds account.register.payments records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountRegisterPaymentss(criteria *Criteria, options *Options) (*AccountRegisterPaymentss, error) { + arps := &AccountRegisterPaymentss{} + if err := c.SearchRead(AccountRegisterPaymentsModel, criteria, options, arps); err != nil { + return nil, err + } + return arps, nil +} + +// FindAccountRegisterPaymentsIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountRegisterPaymentsIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(AccountRegisterPaymentsModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindAccountRegisterPaymentsId finds record id by querying it with criteria. +func (c *Client) FindAccountRegisterPaymentsId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountRegisterPaymentsModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.register.payments was found with criteria %v and options %v", criteria, options) +} diff --git a/account_report_general_ledger.go b/account_report_general_ledger.go new file mode 100644 index 00000000..99304ba0 --- /dev/null +++ b/account_report_general_ledger.go @@ -0,0 +1,126 @@ +package odoo + +import ( + "fmt" +) + +// AccountReportGeneralLedger represents account.report.general.ledger model. +type AccountReportGeneralLedger struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` + DisplayAccount *Selection `xmlrpc:"display_account,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + InitialBalance *Bool `xmlrpc:"initial_balance,omitempty"` + JournalIds *Relation `xmlrpc:"journal_ids,omitempty"` + Sortby *Selection `xmlrpc:"sortby,omitempty"` + TargetMove *Selection `xmlrpc:"target_move,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountReportGeneralLedgers represents array of account.report.general.ledger model. +type AccountReportGeneralLedgers []AccountReportGeneralLedger + +// AccountReportGeneralLedgerModel is the odoo model name. +const AccountReportGeneralLedgerModel = "account.report.general.ledger" + +// Many2One convert AccountReportGeneralLedger to *Many2One. +func (argl *AccountReportGeneralLedger) Many2One() *Many2One { + return NewMany2One(argl.Id.Get(), "") +} + +// CreateAccountReportGeneralLedger creates a new account.report.general.ledger model and returns its id. +func (c *Client) CreateAccountReportGeneralLedger(argl *AccountReportGeneralLedger) (int64, error) { + return c.Create(AccountReportGeneralLedgerModel, argl) +} + +// UpdateAccountReportGeneralLedger updates an existing account.report.general.ledger record. +func (c *Client) UpdateAccountReportGeneralLedger(argl *AccountReportGeneralLedger) error { + return c.UpdateAccountReportGeneralLedgers([]int64{argl.Id.Get()}, argl) +} + +// UpdateAccountReportGeneralLedgers updates existing account.report.general.ledger records. +// All records (represented by ids) will be updated by argl values. +func (c *Client) UpdateAccountReportGeneralLedgers(ids []int64, argl *AccountReportGeneralLedger) error { + return c.Update(AccountReportGeneralLedgerModel, ids, argl) +} + +// DeleteAccountReportGeneralLedger deletes an existing account.report.general.ledger record. +func (c *Client) DeleteAccountReportGeneralLedger(id int64) error { + return c.DeleteAccountReportGeneralLedgers([]int64{id}) +} + +// DeleteAccountReportGeneralLedgers deletes existing account.report.general.ledger records. +func (c *Client) DeleteAccountReportGeneralLedgers(ids []int64) error { + return c.Delete(AccountReportGeneralLedgerModel, ids) +} + +// GetAccountReportGeneralLedger gets account.report.general.ledger existing record. +func (c *Client) GetAccountReportGeneralLedger(id int64) (*AccountReportGeneralLedger, error) { + argls, err := c.GetAccountReportGeneralLedgers([]int64{id}) + if err != nil { + return nil, err + } + if argls != nil && len(*argls) > 0 { + return &((*argls)[0]), nil + } + return nil, fmt.Errorf("id %v of account.report.general.ledger not found", id) +} + +// GetAccountReportGeneralLedgers gets account.report.general.ledger existing records. +func (c *Client) GetAccountReportGeneralLedgers(ids []int64) (*AccountReportGeneralLedgers, error) { + argls := &AccountReportGeneralLedgers{} + if err := c.Read(AccountReportGeneralLedgerModel, ids, nil, argls); err != nil { + return nil, err + } + return argls, nil +} + +// FindAccountReportGeneralLedger finds account.report.general.ledger record by querying it with criteria. +func (c *Client) FindAccountReportGeneralLedger(criteria *Criteria) (*AccountReportGeneralLedger, error) { + argls := &AccountReportGeneralLedgers{} + if err := c.SearchRead(AccountReportGeneralLedgerModel, criteria, NewOptions().Limit(1), argls); err != nil { + return nil, err + } + if argls != nil && len(*argls) > 0 { + return &((*argls)[0]), nil + } + return nil, fmt.Errorf("no account.report.general.ledger was found with criteria %v", criteria) +} + +// FindAccountReportGeneralLedgers finds account.report.general.ledger records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountReportGeneralLedgers(criteria *Criteria, options *Options) (*AccountReportGeneralLedgers, error) { + argls := &AccountReportGeneralLedgers{} + if err := c.SearchRead(AccountReportGeneralLedgerModel, criteria, options, argls); err != nil { + return nil, err + } + return argls, nil +} + +// FindAccountReportGeneralLedgerIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountReportGeneralLedgerIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(AccountReportGeneralLedgerModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindAccountReportGeneralLedgerId finds record id by querying it with criteria. +func (c *Client) FindAccountReportGeneralLedgerId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountReportGeneralLedgerModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.report.general.ledger was found with criteria %v and options %v", criteria, options) +} diff --git a/account_report_partner_ledger.go b/account_report_partner_ledger.go new file mode 100644 index 00000000..d1809ddb --- /dev/null +++ b/account_report_partner_ledger.go @@ -0,0 +1,126 @@ +package odoo + +import ( + "fmt" +) + +// AccountReportPartnerLedger represents account.report.partner.ledger model. +type AccountReportPartnerLedger struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AmountCurrency *Bool `xmlrpc:"amount_currency,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"` + Id *Int `xmlrpc:"id,omitempty"` + JournalIds *Relation `xmlrpc:"journal_ids,omitempty"` + Reconciled *Bool `xmlrpc:"reconciled,omitempty"` + ResultSelection *Selection `xmlrpc:"result_selection,omitempty"` + TargetMove *Selection `xmlrpc:"target_move,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountReportPartnerLedgers represents array of account.report.partner.ledger model. +type AccountReportPartnerLedgers []AccountReportPartnerLedger + +// AccountReportPartnerLedgerModel is the odoo model name. +const AccountReportPartnerLedgerModel = "account.report.partner.ledger" + +// Many2One convert AccountReportPartnerLedger to *Many2One. +func (arpl *AccountReportPartnerLedger) Many2One() *Many2One { + return NewMany2One(arpl.Id.Get(), "") +} + +// CreateAccountReportPartnerLedger creates a new account.report.partner.ledger model and returns its id. +func (c *Client) CreateAccountReportPartnerLedger(arpl *AccountReportPartnerLedger) (int64, error) { + return c.Create(AccountReportPartnerLedgerModel, arpl) +} + +// UpdateAccountReportPartnerLedger updates an existing account.report.partner.ledger record. +func (c *Client) UpdateAccountReportPartnerLedger(arpl *AccountReportPartnerLedger) error { + return c.UpdateAccountReportPartnerLedgers([]int64{arpl.Id.Get()}, arpl) +} + +// UpdateAccountReportPartnerLedgers updates existing account.report.partner.ledger records. +// All records (represented by ids) will be updated by arpl values. +func (c *Client) UpdateAccountReportPartnerLedgers(ids []int64, arpl *AccountReportPartnerLedger) error { + return c.Update(AccountReportPartnerLedgerModel, ids, arpl) +} + +// DeleteAccountReportPartnerLedger deletes an existing account.report.partner.ledger record. +func (c *Client) DeleteAccountReportPartnerLedger(id int64) error { + return c.DeleteAccountReportPartnerLedgers([]int64{id}) +} + +// DeleteAccountReportPartnerLedgers deletes existing account.report.partner.ledger records. +func (c *Client) DeleteAccountReportPartnerLedgers(ids []int64) error { + return c.Delete(AccountReportPartnerLedgerModel, ids) +} + +// GetAccountReportPartnerLedger gets account.report.partner.ledger existing record. +func (c *Client) GetAccountReportPartnerLedger(id int64) (*AccountReportPartnerLedger, error) { + arpls, err := c.GetAccountReportPartnerLedgers([]int64{id}) + if err != nil { + return nil, err + } + if arpls != nil && len(*arpls) > 0 { + return &((*arpls)[0]), nil + } + return nil, fmt.Errorf("id %v of account.report.partner.ledger not found", id) +} + +// GetAccountReportPartnerLedgers gets account.report.partner.ledger existing records. +func (c *Client) GetAccountReportPartnerLedgers(ids []int64) (*AccountReportPartnerLedgers, error) { + arpls := &AccountReportPartnerLedgers{} + if err := c.Read(AccountReportPartnerLedgerModel, ids, nil, arpls); err != nil { + return nil, err + } + return arpls, nil +} + +// FindAccountReportPartnerLedger finds account.report.partner.ledger record by querying it with criteria. +func (c *Client) FindAccountReportPartnerLedger(criteria *Criteria) (*AccountReportPartnerLedger, error) { + arpls := &AccountReportPartnerLedgers{} + if err := c.SearchRead(AccountReportPartnerLedgerModel, criteria, NewOptions().Limit(1), arpls); err != nil { + return nil, err + } + if arpls != nil && len(*arpls) > 0 { + return &((*arpls)[0]), nil + } + return nil, fmt.Errorf("no account.report.partner.ledger was found with criteria %v", criteria) +} + +// FindAccountReportPartnerLedgers finds account.report.partner.ledger records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountReportPartnerLedgers(criteria *Criteria, options *Options) (*AccountReportPartnerLedgers, error) { + arpls := &AccountReportPartnerLedgers{} + if err := c.SearchRead(AccountReportPartnerLedgerModel, criteria, options, arpls); err != nil { + return nil, err + } + return arpls, nil +} + +// FindAccountReportPartnerLedgerIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountReportPartnerLedgerIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(AccountReportPartnerLedgerModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindAccountReportPartnerLedgerId finds record id by querying it with criteria. +func (c *Client) FindAccountReportPartnerLedgerId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountReportPartnerLedgerModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.report.partner.ledger was found with criteria %v and options %v", criteria, options) +} diff --git a/account_tax.go b/account_tax.go new file mode 100644 index 00000000..7eeaa20c --- /dev/null +++ b/account_tax.go @@ -0,0 +1,138 @@ +package odoo + +import ( + "fmt" +) + +// AccountTax represents account.tax model. +type AccountTax struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AccountId *Many2One `xmlrpc:"account_id,omitempty"` + Active *Bool `xmlrpc:"active,omitempty"` + Amount *Float `xmlrpc:"amount,omitempty"` + AmountType *Selection `xmlrpc:"amount_type,omitempty"` + Analytic *Bool `xmlrpc:"analytic,omitempty"` + CashBasisAccount *Many2One `xmlrpc:"cash_basis_account,omitempty"` + ChildrenTaxIds *Relation `xmlrpc:"children_tax_ids,omitempty"` + CompanyId *Many2One `xmlrpc:"company_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"` + HideTaxExigibility *Bool `xmlrpc:"hide_tax_exigibility,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IncludeBaseAmount *Bool `xmlrpc:"include_base_amount,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + PriceInclude *Bool `xmlrpc:"price_include,omitempty"` + RefundAccountId *Many2One `xmlrpc:"refund_account_id,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + TagIds *Relation `xmlrpc:"tag_ids,omitempty"` + TaxAdjustment *Bool `xmlrpc:"tax_adjustment,omitempty"` + TaxExigibility *Selection `xmlrpc:"tax_exigibility,omitempty"` + TaxGroupId *Many2One `xmlrpc:"tax_group_id,omitempty"` + TypeTaxUse *Selection `xmlrpc:"type_tax_use,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) { + return c.Create(AccountTaxModel, at) +} + +// 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) +} + +// 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 + } + if ats != nil && len(*ats) > 0 { + return &((*ats)[0]), nil + } + return nil, fmt.Errorf("id %v of account.tax not found", id) +} + +// 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 + } + if ats != nil && len(*ats) > 0 { + return &((*ats)[0]), nil + } + return nil, fmt.Errorf("no account.tax was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(AccountTaxModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.tax was found with criteria %v and options %v", criteria, options) +} diff --git a/account_tax_group.go b/account_tax_group.go new file mode 100644 index 00000000..0e18fbe9 --- /dev/null +++ b/account_tax_group.go @@ -0,0 +1,120 @@ +package odoo + +import ( + "fmt" +) + +// AccountTaxGroup represents account.tax.group model. +type AccountTaxGroup struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` +} + +// 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) { + return c.Create(AccountTaxGroupModel, atg) +} + +// 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) +} + +// 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 + } + if atgs != nil && len(*atgs) > 0 { + return &((*atgs)[0]), nil + } + return nil, fmt.Errorf("id %v of account.tax.group not found", id) +} + +// 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 + } + if atgs != nil && len(*atgs) > 0 { + return &((*atgs)[0]), nil + } + return nil, fmt.Errorf("no account.tax.group was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(AccountTaxGroupModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.tax.group was found with criteria %v and options %v", criteria, options) +} diff --git a/account_tax_report.go b/account_tax_report.go new file mode 100644 index 00000000..b0f4f70b --- /dev/null +++ b/account_tax_report.go @@ -0,0 +1,123 @@ +package odoo + +import ( + "fmt" +) + +// AccountTaxReport represents account.tax.report model. +type AccountTaxReport struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` + Id *Int `xmlrpc:"id,omitempty"` + JournalIds *Relation `xmlrpc:"journal_ids,omitempty"` + TargetMove *Selection `xmlrpc:"target_move,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountTaxReports represents array of account.tax.report model. +type AccountTaxReports []AccountTaxReport + +// AccountTaxReportModel is the odoo model name. +const AccountTaxReportModel = "account.tax.report" + +// Many2One convert AccountTaxReport to *Many2One. +func (atr *AccountTaxReport) Many2One() *Many2One { + return NewMany2One(atr.Id.Get(), "") +} + +// CreateAccountTaxReport creates a new account.tax.report model and returns its id. +func (c *Client) CreateAccountTaxReport(atr *AccountTaxReport) (int64, error) { + return c.Create(AccountTaxReportModel, atr) +} + +// UpdateAccountTaxReport updates an existing account.tax.report record. +func (c *Client) UpdateAccountTaxReport(atr *AccountTaxReport) error { + return c.UpdateAccountTaxReports([]int64{atr.Id.Get()}, atr) +} + +// UpdateAccountTaxReports updates existing account.tax.report records. +// All records (represented by ids) will be updated by atr values. +func (c *Client) UpdateAccountTaxReports(ids []int64, atr *AccountTaxReport) error { + return c.Update(AccountTaxReportModel, ids, atr) +} + +// DeleteAccountTaxReport deletes an existing account.tax.report record. +func (c *Client) DeleteAccountTaxReport(id int64) error { + return c.DeleteAccountTaxReports([]int64{id}) +} + +// DeleteAccountTaxReports deletes existing account.tax.report records. +func (c *Client) DeleteAccountTaxReports(ids []int64) error { + return c.Delete(AccountTaxReportModel, ids) +} + +// GetAccountTaxReport gets account.tax.report existing record. +func (c *Client) GetAccountTaxReport(id int64) (*AccountTaxReport, error) { + atrs, err := c.GetAccountTaxReports([]int64{id}) + if err != nil { + return nil, err + } + if atrs != nil && len(*atrs) > 0 { + return &((*atrs)[0]), nil + } + return nil, fmt.Errorf("id %v of account.tax.report not found", id) +} + +// GetAccountTaxReports gets account.tax.report existing records. +func (c *Client) GetAccountTaxReports(ids []int64) (*AccountTaxReports, error) { + atrs := &AccountTaxReports{} + if err := c.Read(AccountTaxReportModel, ids, nil, atrs); err != nil { + return nil, err + } + return atrs, nil +} + +// FindAccountTaxReport finds account.tax.report record by querying it with criteria. +func (c *Client) FindAccountTaxReport(criteria *Criteria) (*AccountTaxReport, error) { + atrs := &AccountTaxReports{} + if err := c.SearchRead(AccountTaxReportModel, criteria, NewOptions().Limit(1), atrs); err != nil { + return nil, err + } + if atrs != nil && len(*atrs) > 0 { + return &((*atrs)[0]), nil + } + return nil, fmt.Errorf("no account.tax.report was found with criteria %v", criteria) +} + +// FindAccountTaxReports finds account.tax.report records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountTaxReports(criteria *Criteria, options *Options) (*AccountTaxReports, error) { + atrs := &AccountTaxReports{} + if err := c.SearchRead(AccountTaxReportModel, criteria, options, atrs); err != nil { + return nil, err + } + return atrs, nil +} + +// FindAccountTaxReportIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountTaxReportIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(AccountTaxReportModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindAccountTaxReportId finds record id by querying it with criteria. +func (c *Client) FindAccountTaxReportId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountTaxReportModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.tax.report was found with criteria %v and options %v", criteria, options) +} diff --git a/account_tax_template.go b/account_tax_template.go new file mode 100644 index 00000000..57764df0 --- /dev/null +++ b/account_tax_template.go @@ -0,0 +1,138 @@ +package odoo + +import ( + "fmt" +) + +// AccountTaxTemplate represents account.tax.template model. +type AccountTaxTemplate struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AccountId *Many2One `xmlrpc:"account_id,omitempty"` + Active *Bool `xmlrpc:"active,omitempty"` + Amount *Float `xmlrpc:"amount,omitempty"` + AmountType *Selection `xmlrpc:"amount_type,omitempty"` + Analytic *Bool `xmlrpc:"analytic,omitempty"` + CashBasisAccount *Many2One `xmlrpc:"cash_basis_account,omitempty"` + ChartTemplateId *Many2One `xmlrpc:"chart_template_id,omitempty"` + ChildrenTaxIds *Relation `xmlrpc:"children_tax_ids,omitempty"` + CompanyId *Many2One `xmlrpc:"company_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"` + Id *Int `xmlrpc:"id,omitempty"` + IncludeBaseAmount *Bool `xmlrpc:"include_base_amount,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + PriceInclude *Bool `xmlrpc:"price_include,omitempty"` + RefundAccountId *Many2One `xmlrpc:"refund_account_id,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + TagIds *Relation `xmlrpc:"tag_ids,omitempty"` + TaxAdjustment *Bool `xmlrpc:"tax_adjustment,omitempty"` + TaxExigibility *Selection `xmlrpc:"tax_exigibility,omitempty"` + TaxGroupId *Many2One `xmlrpc:"tax_group_id,omitempty"` + TypeTaxUse *Selection `xmlrpc:"type_tax_use,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountTaxTemplates represents array of account.tax.template model. +type AccountTaxTemplates []AccountTaxTemplate + +// AccountTaxTemplateModel is the odoo model name. +const AccountTaxTemplateModel = "account.tax.template" + +// Many2One convert AccountTaxTemplate to *Many2One. +func (att *AccountTaxTemplate) Many2One() *Many2One { + return NewMany2One(att.Id.Get(), "") +} + +// CreateAccountTaxTemplate creates a new account.tax.template model and returns its id. +func (c *Client) CreateAccountTaxTemplate(att *AccountTaxTemplate) (int64, error) { + return c.Create(AccountTaxTemplateModel, att) +} + +// UpdateAccountTaxTemplate updates an existing account.tax.template record. +func (c *Client) UpdateAccountTaxTemplate(att *AccountTaxTemplate) error { + return c.UpdateAccountTaxTemplates([]int64{att.Id.Get()}, att) +} + +// UpdateAccountTaxTemplates updates existing account.tax.template records. +// All records (represented by ids) will be updated by att values. +func (c *Client) UpdateAccountTaxTemplates(ids []int64, att *AccountTaxTemplate) error { + return c.Update(AccountTaxTemplateModel, ids, att) +} + +// DeleteAccountTaxTemplate deletes an existing account.tax.template record. +func (c *Client) DeleteAccountTaxTemplate(id int64) error { + return c.DeleteAccountTaxTemplates([]int64{id}) +} + +// DeleteAccountTaxTemplates deletes existing account.tax.template records. +func (c *Client) DeleteAccountTaxTemplates(ids []int64) error { + return c.Delete(AccountTaxTemplateModel, ids) +} + +// GetAccountTaxTemplate gets account.tax.template existing record. +func (c *Client) GetAccountTaxTemplate(id int64) (*AccountTaxTemplate, error) { + atts, err := c.GetAccountTaxTemplates([]int64{id}) + if err != nil { + return nil, err + } + if atts != nil && len(*atts) > 0 { + return &((*atts)[0]), nil + } + return nil, fmt.Errorf("id %v of account.tax.template not found", id) +} + +// GetAccountTaxTemplates gets account.tax.template existing records. +func (c *Client) GetAccountTaxTemplates(ids []int64) (*AccountTaxTemplates, error) { + atts := &AccountTaxTemplates{} + if err := c.Read(AccountTaxTemplateModel, ids, nil, atts); err != nil { + return nil, err + } + return atts, nil +} + +// FindAccountTaxTemplate finds account.tax.template record by querying it with criteria. +func (c *Client) FindAccountTaxTemplate(criteria *Criteria) (*AccountTaxTemplate, error) { + atts := &AccountTaxTemplates{} + if err := c.SearchRead(AccountTaxTemplateModel, criteria, NewOptions().Limit(1), atts); err != nil { + return nil, err + } + if atts != nil && len(*atts) > 0 { + return &((*atts)[0]), nil + } + return nil, fmt.Errorf("no account.tax.template was found with criteria %v", criteria) +} + +// FindAccountTaxTemplates finds account.tax.template records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountTaxTemplates(criteria *Criteria, options *Options) (*AccountTaxTemplates, error) { + atts := &AccountTaxTemplates{} + if err := c.SearchRead(AccountTaxTemplateModel, criteria, options, atts); err != nil { + return nil, err + } + return atts, nil +} + +// FindAccountTaxTemplateIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountTaxTemplateIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(AccountTaxTemplateModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindAccountTaxTemplateId finds record id by querying it with criteria. +func (c *Client) FindAccountTaxTemplateId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountTaxTemplateModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.tax.template was found with criteria %v and options %v", criteria, options) +} diff --git a/account_unreconcile.go b/account_unreconcile.go new file mode 100644 index 00000000..b0cf4d3b --- /dev/null +++ b/account_unreconcile.go @@ -0,0 +1,118 @@ +package odoo + +import ( + "fmt" +) + +// AccountUnreconcile represents account.unreconcile model. +type AccountUnreconcile struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` +} + +// AccountUnreconciles represents array of account.unreconcile model. +type AccountUnreconciles []AccountUnreconcile + +// AccountUnreconcileModel is the odoo model name. +const AccountUnreconcileModel = "account.unreconcile" + +// Many2One convert AccountUnreconcile to *Many2One. +func (au *AccountUnreconcile) Many2One() *Many2One { + return NewMany2One(au.Id.Get(), "") +} + +// CreateAccountUnreconcile creates a new account.unreconcile model and returns its id. +func (c *Client) CreateAccountUnreconcile(au *AccountUnreconcile) (int64, error) { + return c.Create(AccountUnreconcileModel, au) +} + +// UpdateAccountUnreconcile updates an existing account.unreconcile record. +func (c *Client) UpdateAccountUnreconcile(au *AccountUnreconcile) error { + return c.UpdateAccountUnreconciles([]int64{au.Id.Get()}, au) +} + +// UpdateAccountUnreconciles updates existing account.unreconcile records. +// All records (represented by ids) will be updated by au values. +func (c *Client) UpdateAccountUnreconciles(ids []int64, au *AccountUnreconcile) error { + return c.Update(AccountUnreconcileModel, ids, au) +} + +// DeleteAccountUnreconcile deletes an existing account.unreconcile record. +func (c *Client) DeleteAccountUnreconcile(id int64) error { + return c.DeleteAccountUnreconciles([]int64{id}) +} + +// DeleteAccountUnreconciles deletes existing account.unreconcile records. +func (c *Client) DeleteAccountUnreconciles(ids []int64) error { + return c.Delete(AccountUnreconcileModel, ids) +} + +// GetAccountUnreconcile gets account.unreconcile existing record. +func (c *Client) GetAccountUnreconcile(id int64) (*AccountUnreconcile, error) { + aus, err := c.GetAccountUnreconciles([]int64{id}) + if err != nil { + return nil, err + } + if aus != nil && len(*aus) > 0 { + return &((*aus)[0]), nil + } + return nil, fmt.Errorf("id %v of account.unreconcile not found", id) +} + +// GetAccountUnreconciles gets account.unreconcile existing records. +func (c *Client) GetAccountUnreconciles(ids []int64) (*AccountUnreconciles, error) { + aus := &AccountUnreconciles{} + if err := c.Read(AccountUnreconcileModel, ids, nil, aus); err != nil { + return nil, err + } + return aus, nil +} + +// FindAccountUnreconcile finds account.unreconcile record by querying it with criteria. +func (c *Client) FindAccountUnreconcile(criteria *Criteria) (*AccountUnreconcile, error) { + aus := &AccountUnreconciles{} + if err := c.SearchRead(AccountUnreconcileModel, criteria, NewOptions().Limit(1), aus); err != nil { + return nil, err + } + if aus != nil && len(*aus) > 0 { + return &((*aus)[0]), nil + } + return nil, fmt.Errorf("no account.unreconcile was found with criteria %v", criteria) +} + +// FindAccountUnreconciles finds account.unreconcile records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountUnreconciles(criteria *Criteria, options *Options) (*AccountUnreconciles, error) { + aus := &AccountUnreconciles{} + if err := c.SearchRead(AccountUnreconcileModel, criteria, options, aus); err != nil { + return nil, err + } + return aus, nil +} + +// FindAccountUnreconcileIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountUnreconcileIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(AccountUnreconcileModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindAccountUnreconcileId finds record id by querying it with criteria. +func (c *Client) FindAccountUnreconcileId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountUnreconcileModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no account.unreconcile was found with criteria %v and options %v", criteria, options) +} diff --git a/accounting_report.go b/accounting_report.go new file mode 100644 index 00000000..8ca16c9e --- /dev/null +++ b/accounting_report.go @@ -0,0 +1,130 @@ +package odoo + +import ( + "fmt" +) + +// AccountingReport represents accounting.report model. +type AccountingReport struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AccountReportId *Many2One `xmlrpc:"account_report_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"` + DateFromCmp *Time `xmlrpc:"date_from_cmp,omitempty"` + DateTo *Time `xmlrpc:"date_to,omitempty"` + DateToCmp *Time `xmlrpc:"date_to_cmp,omitempty"` + DebitCredit *Bool `xmlrpc:"debit_credit,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + EnableFilter *Bool `xmlrpc:"enable_filter,omitempty"` + FilterCmp *Selection `xmlrpc:"filter_cmp,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + JournalIds *Relation `xmlrpc:"journal_ids,omitempty"` + LabelFilter *String `xmlrpc:"label_filter,omitempty"` + TargetMove *Selection `xmlrpc:"target_move,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountingReports represents array of accounting.report model. +type AccountingReports []AccountingReport + +// AccountingReportModel is the odoo model name. +const AccountingReportModel = "accounting.report" + +// Many2One convert AccountingReport to *Many2One. +func (ar *AccountingReport) Many2One() *Many2One { + return NewMany2One(ar.Id.Get(), "") +} + +// CreateAccountingReport creates a new accounting.report model and returns its id. +func (c *Client) CreateAccountingReport(ar *AccountingReport) (int64, error) { + return c.Create(AccountingReportModel, ar) +} + +// UpdateAccountingReport updates an existing accounting.report record. +func (c *Client) UpdateAccountingReport(ar *AccountingReport) error { + return c.UpdateAccountingReports([]int64{ar.Id.Get()}, ar) +} + +// UpdateAccountingReports updates existing accounting.report records. +// All records (represented by ids) will be updated by ar values. +func (c *Client) UpdateAccountingReports(ids []int64, ar *AccountingReport) error { + return c.Update(AccountingReportModel, ids, ar) +} + +// DeleteAccountingReport deletes an existing accounting.report record. +func (c *Client) DeleteAccountingReport(id int64) error { + return c.DeleteAccountingReports([]int64{id}) +} + +// DeleteAccountingReports deletes existing accounting.report records. +func (c *Client) DeleteAccountingReports(ids []int64) error { + return c.Delete(AccountingReportModel, ids) +} + +// GetAccountingReport gets accounting.report existing record. +func (c *Client) GetAccountingReport(id int64) (*AccountingReport, error) { + ars, err := c.GetAccountingReports([]int64{id}) + if err != nil { + return nil, err + } + if ars != nil && len(*ars) > 0 { + return &((*ars)[0]), nil + } + return nil, fmt.Errorf("id %v of accounting.report not found", id) +} + +// GetAccountingReports gets accounting.report existing records. +func (c *Client) GetAccountingReports(ids []int64) (*AccountingReports, error) { + ars := &AccountingReports{} + if err := c.Read(AccountingReportModel, ids, nil, ars); err != nil { + return nil, err + } + return ars, nil +} + +// FindAccountingReport finds accounting.report record by querying it with criteria. +func (c *Client) FindAccountingReport(criteria *Criteria) (*AccountingReport, error) { + ars := &AccountingReports{} + if err := c.SearchRead(AccountingReportModel, criteria, NewOptions().Limit(1), ars); err != nil { + return nil, err + } + if ars != nil && len(*ars) > 0 { + return &((*ars)[0]), nil + } + return nil, fmt.Errorf("no accounting.report was found with criteria %v", criteria) +} + +// FindAccountingReports finds accounting.report records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountingReports(criteria *Criteria, options *Options) (*AccountingReports, error) { + ars := &AccountingReports{} + if err := c.SearchRead(AccountingReportModel, criteria, options, ars); err != nil { + return nil, err + } + return ars, nil +} + +// FindAccountingReportIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountingReportIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(AccountingReportModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindAccountingReportId finds record id by querying it with criteria. +func (c *Client) FindAccountingReportId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountingReportModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no accounting.report was found with criteria %v and options %v", criteria, options) +} diff --git a/autosales_config.go b/autosales_config.go new file mode 100644 index 00000000..f2599334 --- /dev/null +++ b/autosales_config.go @@ -0,0 +1,121 @@ +package odoo + +import ( + "fmt" +) + +// AutosalesConfig represents autosales.config model. +type AutosalesConfig struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + ConfigLine *Relation `xmlrpc:"config_line,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"` +} + +// AutosalesConfigs represents array of autosales.config model. +type AutosalesConfigs []AutosalesConfig + +// AutosalesConfigModel is the odoo model name. +const AutosalesConfigModel = "autosales.config" + +// Many2One convert AutosalesConfig to *Many2One. +func (ac *AutosalesConfig) Many2One() *Many2One { + return NewMany2One(ac.Id.Get(), "") +} + +// CreateAutosalesConfig creates a new autosales.config model and returns its id. +func (c *Client) CreateAutosalesConfig(ac *AutosalesConfig) (int64, error) { + return c.Create(AutosalesConfigModel, ac) +} + +// UpdateAutosalesConfig updates an existing autosales.config record. +func (c *Client) UpdateAutosalesConfig(ac *AutosalesConfig) error { + return c.UpdateAutosalesConfigs([]int64{ac.Id.Get()}, ac) +} + +// UpdateAutosalesConfigs updates existing autosales.config records. +// All records (represented by ids) will be updated by ac values. +func (c *Client) UpdateAutosalesConfigs(ids []int64, ac *AutosalesConfig) error { + return c.Update(AutosalesConfigModel, ids, ac) +} + +// DeleteAutosalesConfig deletes an existing autosales.config record. +func (c *Client) DeleteAutosalesConfig(id int64) error { + return c.DeleteAutosalesConfigs([]int64{id}) +} + +// DeleteAutosalesConfigs deletes existing autosales.config records. +func (c *Client) DeleteAutosalesConfigs(ids []int64) error { + return c.Delete(AutosalesConfigModel, ids) +} + +// GetAutosalesConfig gets autosales.config existing record. +func (c *Client) GetAutosalesConfig(id int64) (*AutosalesConfig, error) { + acs, err := c.GetAutosalesConfigs([]int64{id}) + if err != nil { + return nil, err + } + if acs != nil && len(*acs) > 0 { + return &((*acs)[0]), nil + } + return nil, fmt.Errorf("id %v of autosales.config not found", id) +} + +// GetAutosalesConfigs gets autosales.config existing records. +func (c *Client) GetAutosalesConfigs(ids []int64) (*AutosalesConfigs, error) { + acs := &AutosalesConfigs{} + if err := c.Read(AutosalesConfigModel, ids, nil, acs); err != nil { + return nil, err + } + return acs, nil +} + +// FindAutosalesConfig finds autosales.config record by querying it with criteria. +func (c *Client) FindAutosalesConfig(criteria *Criteria) (*AutosalesConfig, error) { + acs := &AutosalesConfigs{} + if err := c.SearchRead(AutosalesConfigModel, criteria, NewOptions().Limit(1), acs); err != nil { + return nil, err + } + if acs != nil && len(*acs) > 0 { + return &((*acs)[0]), nil + } + return nil, fmt.Errorf("no autosales.config was found with criteria %v", criteria) +} + +// FindAutosalesConfigs finds autosales.config records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAutosalesConfigs(criteria *Criteria, options *Options) (*AutosalesConfigs, error) { + acs := &AutosalesConfigs{} + if err := c.SearchRead(AutosalesConfigModel, criteria, options, acs); err != nil { + return nil, err + } + return acs, nil +} + +// FindAutosalesConfigIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAutosalesConfigIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(AutosalesConfigModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindAutosalesConfigId finds record id by querying it with criteria. +func (c *Client) FindAutosalesConfigId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AutosalesConfigModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no autosales.config was found with criteria %v and options %v", criteria, options) +} diff --git a/autosales_config_line.go b/autosales_config_line.go new file mode 100644 index 00000000..d4fd1480 --- /dev/null +++ b/autosales_config_line.go @@ -0,0 +1,123 @@ +package odoo + +import ( + "fmt" +) + +// AutosalesConfigLine represents autosales.config.line model. +type AutosalesConfigLine struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AutosalesConfigId *Many2One `xmlrpc:"autosales_config_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"` + PercentProductBase *Float `xmlrpc:"percent_product_base,omitempty"` + ProductAuto *Many2One `xmlrpc:"product_auto,omitempty"` + ProductBase *Many2One `xmlrpc:"product_base,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AutosalesConfigLines represents array of autosales.config.line model. +type AutosalesConfigLines []AutosalesConfigLine + +// AutosalesConfigLineModel is the odoo model name. +const AutosalesConfigLineModel = "autosales.config.line" + +// Many2One convert AutosalesConfigLine to *Many2One. +func (acl *AutosalesConfigLine) Many2One() *Many2One { + return NewMany2One(acl.Id.Get(), "") +} + +// CreateAutosalesConfigLine creates a new autosales.config.line model and returns its id. +func (c *Client) CreateAutosalesConfigLine(acl *AutosalesConfigLine) (int64, error) { + return c.Create(AutosalesConfigLineModel, acl) +} + +// UpdateAutosalesConfigLine updates an existing autosales.config.line record. +func (c *Client) UpdateAutosalesConfigLine(acl *AutosalesConfigLine) error { + return c.UpdateAutosalesConfigLines([]int64{acl.Id.Get()}, acl) +} + +// UpdateAutosalesConfigLines updates existing autosales.config.line records. +// All records (represented by ids) will be updated by acl values. +func (c *Client) UpdateAutosalesConfigLines(ids []int64, acl *AutosalesConfigLine) error { + return c.Update(AutosalesConfigLineModel, ids, acl) +} + +// DeleteAutosalesConfigLine deletes an existing autosales.config.line record. +func (c *Client) DeleteAutosalesConfigLine(id int64) error { + return c.DeleteAutosalesConfigLines([]int64{id}) +} + +// DeleteAutosalesConfigLines deletes existing autosales.config.line records. +func (c *Client) DeleteAutosalesConfigLines(ids []int64) error { + return c.Delete(AutosalesConfigLineModel, ids) +} + +// GetAutosalesConfigLine gets autosales.config.line existing record. +func (c *Client) GetAutosalesConfigLine(id int64) (*AutosalesConfigLine, error) { + acls, err := c.GetAutosalesConfigLines([]int64{id}) + if err != nil { + return nil, err + } + if acls != nil && len(*acls) > 0 { + return &((*acls)[0]), nil + } + return nil, fmt.Errorf("id %v of autosales.config.line not found", id) +} + +// GetAutosalesConfigLines gets autosales.config.line existing records. +func (c *Client) GetAutosalesConfigLines(ids []int64) (*AutosalesConfigLines, error) { + acls := &AutosalesConfigLines{} + if err := c.Read(AutosalesConfigLineModel, ids, nil, acls); err != nil { + return nil, err + } + return acls, nil +} + +// FindAutosalesConfigLine finds autosales.config.line record by querying it with criteria. +func (c *Client) FindAutosalesConfigLine(criteria *Criteria) (*AutosalesConfigLine, error) { + acls := &AutosalesConfigLines{} + if err := c.SearchRead(AutosalesConfigLineModel, criteria, NewOptions().Limit(1), acls); err != nil { + return nil, err + } + if acls != nil && len(*acls) > 0 { + return &((*acls)[0]), nil + } + return nil, fmt.Errorf("no autosales.config.line was found with criteria %v", criteria) +} + +// FindAutosalesConfigLines finds autosales.config.line records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAutosalesConfigLines(criteria *Criteria, options *Options) (*AutosalesConfigLines, error) { + acls := &AutosalesConfigLines{} + if err := c.SearchRead(AutosalesConfigLineModel, criteria, options, acls); err != nil { + return nil, err + } + return acls, nil +} + +// FindAutosalesConfigLineIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAutosalesConfigLineIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(AutosalesConfigLineModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindAutosalesConfigLineId finds record id by querying it with criteria. +func (c *Client) FindAutosalesConfigLineId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AutosalesConfigLineModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no autosales.config.line was found with criteria %v and options %v", criteria, options) +} diff --git a/barcode_nomenclature.go b/barcode_nomenclature.go new file mode 100644 index 00000000..1cfb4fef --- /dev/null +++ b/barcode_nomenclature.go @@ -0,0 +1,121 @@ +package odoo + +import ( + "fmt" +) + +// BarcodeNomenclature represents barcode.nomenclature model. +type BarcodeNomenclature struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` + RuleIds *Relation `xmlrpc:"rule_ids,omitempty"` + UpcEanConv *Selection `xmlrpc:"upc_ean_conv,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// BarcodeNomenclatures represents array of barcode.nomenclature model. +type BarcodeNomenclatures []BarcodeNomenclature + +// BarcodeNomenclatureModel is the odoo model name. +const BarcodeNomenclatureModel = "barcode.nomenclature" + +// Many2One convert BarcodeNomenclature to *Many2One. +func (bn *BarcodeNomenclature) Many2One() *Many2One { + return NewMany2One(bn.Id.Get(), "") +} + +// CreateBarcodeNomenclature creates a new barcode.nomenclature model and returns its id. +func (c *Client) CreateBarcodeNomenclature(bn *BarcodeNomenclature) (int64, error) { + return c.Create(BarcodeNomenclatureModel, bn) +} + +// UpdateBarcodeNomenclature updates an existing barcode.nomenclature record. +func (c *Client) UpdateBarcodeNomenclature(bn *BarcodeNomenclature) error { + return c.UpdateBarcodeNomenclatures([]int64{bn.Id.Get()}, bn) +} + +// UpdateBarcodeNomenclatures updates existing barcode.nomenclature records. +// All records (represented by ids) will be updated by bn values. +func (c *Client) UpdateBarcodeNomenclatures(ids []int64, bn *BarcodeNomenclature) error { + return c.Update(BarcodeNomenclatureModel, ids, bn) +} + +// DeleteBarcodeNomenclature deletes an existing barcode.nomenclature record. +func (c *Client) DeleteBarcodeNomenclature(id int64) error { + return c.DeleteBarcodeNomenclatures([]int64{id}) +} + +// DeleteBarcodeNomenclatures deletes existing barcode.nomenclature records. +func (c *Client) DeleteBarcodeNomenclatures(ids []int64) error { + return c.Delete(BarcodeNomenclatureModel, ids) +} + +// GetBarcodeNomenclature gets barcode.nomenclature existing record. +func (c *Client) GetBarcodeNomenclature(id int64) (*BarcodeNomenclature, error) { + bns, err := c.GetBarcodeNomenclatures([]int64{id}) + if err != nil { + return nil, err + } + if bns != nil && len(*bns) > 0 { + return &((*bns)[0]), nil + } + return nil, fmt.Errorf("id %v of barcode.nomenclature not found", id) +} + +// GetBarcodeNomenclatures gets barcode.nomenclature existing records. +func (c *Client) GetBarcodeNomenclatures(ids []int64) (*BarcodeNomenclatures, error) { + bns := &BarcodeNomenclatures{} + if err := c.Read(BarcodeNomenclatureModel, ids, nil, bns); err != nil { + return nil, err + } + return bns, nil +} + +// FindBarcodeNomenclature finds barcode.nomenclature record by querying it with criteria. +func (c *Client) FindBarcodeNomenclature(criteria *Criteria) (*BarcodeNomenclature, error) { + bns := &BarcodeNomenclatures{} + if err := c.SearchRead(BarcodeNomenclatureModel, criteria, NewOptions().Limit(1), bns); err != nil { + return nil, err + } + if bns != nil && len(*bns) > 0 { + return &((*bns)[0]), nil + } + return nil, fmt.Errorf("no barcode.nomenclature was found with criteria %v", criteria) +} + +// FindBarcodeNomenclatures finds barcode.nomenclature records by querying it +// and filtering it with criteria and options. +func (c *Client) FindBarcodeNomenclatures(criteria *Criteria, options *Options) (*BarcodeNomenclatures, error) { + bns := &BarcodeNomenclatures{} + if err := c.SearchRead(BarcodeNomenclatureModel, criteria, options, bns); err != nil { + return nil, err + } + return bns, nil +} + +// FindBarcodeNomenclatureIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindBarcodeNomenclatureIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(BarcodeNomenclatureModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindBarcodeNomenclatureId finds record id by querying it with criteria. +func (c *Client) FindBarcodeNomenclatureId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(BarcodeNomenclatureModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no barcode.nomenclature was found with criteria %v and options %v", criteria, options) +} diff --git a/barcode_rule.go b/barcode_rule.go new file mode 100644 index 00000000..16ee901e --- /dev/null +++ b/barcode_rule.go @@ -0,0 +1,125 @@ +package odoo + +import ( + "fmt" +) + +// BarcodeRule represents barcode.rule model. +type BarcodeRule struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + Alias *String `xmlrpc:"alias,omitempty"` + BarcodeNomenclatureId *Many2One `xmlrpc:"barcode_nomenclature_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Encoding *Selection `xmlrpc:"encoding,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Pattern *String `xmlrpc:"pattern,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + Type *Selection `xmlrpc:"type,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// BarcodeRules represents array of barcode.rule model. +type BarcodeRules []BarcodeRule + +// BarcodeRuleModel is the odoo model name. +const BarcodeRuleModel = "barcode.rule" + +// Many2One convert BarcodeRule to *Many2One. +func (br *BarcodeRule) Many2One() *Many2One { + return NewMany2One(br.Id.Get(), "") +} + +// CreateBarcodeRule creates a new barcode.rule model and returns its id. +func (c *Client) CreateBarcodeRule(br *BarcodeRule) (int64, error) { + return c.Create(BarcodeRuleModel, br) +} + +// UpdateBarcodeRule updates an existing barcode.rule record. +func (c *Client) UpdateBarcodeRule(br *BarcodeRule) error { + return c.UpdateBarcodeRules([]int64{br.Id.Get()}, br) +} + +// UpdateBarcodeRules updates existing barcode.rule records. +// All records (represented by ids) will be updated by br values. +func (c *Client) UpdateBarcodeRules(ids []int64, br *BarcodeRule) error { + return c.Update(BarcodeRuleModel, ids, br) +} + +// DeleteBarcodeRule deletes an existing barcode.rule record. +func (c *Client) DeleteBarcodeRule(id int64) error { + return c.DeleteBarcodeRules([]int64{id}) +} + +// DeleteBarcodeRules deletes existing barcode.rule records. +func (c *Client) DeleteBarcodeRules(ids []int64) error { + return c.Delete(BarcodeRuleModel, ids) +} + +// GetBarcodeRule gets barcode.rule existing record. +func (c *Client) GetBarcodeRule(id int64) (*BarcodeRule, error) { + brs, err := c.GetBarcodeRules([]int64{id}) + if err != nil { + return nil, err + } + if brs != nil && len(*brs) > 0 { + return &((*brs)[0]), nil + } + return nil, fmt.Errorf("id %v of barcode.rule not found", id) +} + +// GetBarcodeRules gets barcode.rule existing records. +func (c *Client) GetBarcodeRules(ids []int64) (*BarcodeRules, error) { + brs := &BarcodeRules{} + if err := c.Read(BarcodeRuleModel, ids, nil, brs); err != nil { + return nil, err + } + return brs, nil +} + +// FindBarcodeRule finds barcode.rule record by querying it with criteria. +func (c *Client) FindBarcodeRule(criteria *Criteria) (*BarcodeRule, error) { + brs := &BarcodeRules{} + if err := c.SearchRead(BarcodeRuleModel, criteria, NewOptions().Limit(1), brs); err != nil { + return nil, err + } + if brs != nil && len(*brs) > 0 { + return &((*brs)[0]), nil + } + return nil, fmt.Errorf("no barcode.rule was found with criteria %v", criteria) +} + +// FindBarcodeRules finds barcode.rule records by querying it +// and filtering it with criteria and options. +func (c *Client) FindBarcodeRules(criteria *Criteria, options *Options) (*BarcodeRules, error) { + brs := &BarcodeRules{} + if err := c.SearchRead(BarcodeRuleModel, criteria, options, brs); err != nil { + return nil, err + } + return brs, nil +} + +// FindBarcodeRuleIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindBarcodeRuleIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(BarcodeRuleModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindBarcodeRuleId finds record id by querying it with criteria. +func (c *Client) FindBarcodeRuleId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(BarcodeRuleModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no barcode.rule was found with criteria %v and options %v", criteria, options) +} diff --git a/barcodes_barcode_events_mixin.go b/barcodes_barcode_events_mixin.go new file mode 100644 index 00000000..5ff99c5d --- /dev/null +++ b/barcodes_barcode_events_mixin.go @@ -0,0 +1,115 @@ +package odoo + +import ( + "fmt" +) + +// BarcodesBarcodeEventsMixin represents barcodes.barcode_events_mixin model. +type BarcodesBarcodeEventsMixin struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + BarcodeScanned *String `xmlrpc:"_barcode_scanned,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` +} + +// BarcodesBarcodeEventsMixins represents array of barcodes.barcode_events_mixin model. +type BarcodesBarcodeEventsMixins []BarcodesBarcodeEventsMixin + +// BarcodesBarcodeEventsMixinModel is the odoo model name. +const BarcodesBarcodeEventsMixinModel = "barcodes.barcode_events_mixin" + +// Many2One convert BarcodesBarcodeEventsMixin to *Many2One. +func (bb *BarcodesBarcodeEventsMixin) Many2One() *Many2One { + return NewMany2One(bb.Id.Get(), "") +} + +// CreateBarcodesBarcodeEventsMixin creates a new barcodes.barcode_events_mixin model and returns its id. +func (c *Client) CreateBarcodesBarcodeEventsMixin(bb *BarcodesBarcodeEventsMixin) (int64, error) { + return c.Create(BarcodesBarcodeEventsMixinModel, bb) +} + +// UpdateBarcodesBarcodeEventsMixin updates an existing barcodes.barcode_events_mixin record. +func (c *Client) UpdateBarcodesBarcodeEventsMixin(bb *BarcodesBarcodeEventsMixin) error { + return c.UpdateBarcodesBarcodeEventsMixins([]int64{bb.Id.Get()}, bb) +} + +// UpdateBarcodesBarcodeEventsMixins updates existing barcodes.barcode_events_mixin records. +// All records (represented by ids) will be updated by bb values. +func (c *Client) UpdateBarcodesBarcodeEventsMixins(ids []int64, bb *BarcodesBarcodeEventsMixin) error { + return c.Update(BarcodesBarcodeEventsMixinModel, ids, bb) +} + +// DeleteBarcodesBarcodeEventsMixin deletes an existing barcodes.barcode_events_mixin record. +func (c *Client) DeleteBarcodesBarcodeEventsMixin(id int64) error { + return c.DeleteBarcodesBarcodeEventsMixins([]int64{id}) +} + +// DeleteBarcodesBarcodeEventsMixins deletes existing barcodes.barcode_events_mixin records. +func (c *Client) DeleteBarcodesBarcodeEventsMixins(ids []int64) error { + return c.Delete(BarcodesBarcodeEventsMixinModel, ids) +} + +// GetBarcodesBarcodeEventsMixin gets barcodes.barcode_events_mixin existing record. +func (c *Client) GetBarcodesBarcodeEventsMixin(id int64) (*BarcodesBarcodeEventsMixin, error) { + bbs, err := c.GetBarcodesBarcodeEventsMixins([]int64{id}) + if err != nil { + return nil, err + } + if bbs != nil && len(*bbs) > 0 { + return &((*bbs)[0]), nil + } + return nil, fmt.Errorf("id %v of barcodes.barcode_events_mixin not found", id) +} + +// GetBarcodesBarcodeEventsMixins gets barcodes.barcode_events_mixin existing records. +func (c *Client) GetBarcodesBarcodeEventsMixins(ids []int64) (*BarcodesBarcodeEventsMixins, error) { + bbs := &BarcodesBarcodeEventsMixins{} + if err := c.Read(BarcodesBarcodeEventsMixinModel, ids, nil, bbs); err != nil { + return nil, err + } + return bbs, nil +} + +// FindBarcodesBarcodeEventsMixin finds barcodes.barcode_events_mixin record by querying it with criteria. +func (c *Client) FindBarcodesBarcodeEventsMixin(criteria *Criteria) (*BarcodesBarcodeEventsMixin, error) { + bbs := &BarcodesBarcodeEventsMixins{} + if err := c.SearchRead(BarcodesBarcodeEventsMixinModel, criteria, NewOptions().Limit(1), bbs); err != nil { + return nil, err + } + if bbs != nil && len(*bbs) > 0 { + return &((*bbs)[0]), nil + } + return nil, fmt.Errorf("no barcodes.barcode_events_mixin was found with criteria %v", criteria) +} + +// FindBarcodesBarcodeEventsMixins finds barcodes.barcode_events_mixin records by querying it +// and filtering it with criteria and options. +func (c *Client) FindBarcodesBarcodeEventsMixins(criteria *Criteria, options *Options) (*BarcodesBarcodeEventsMixins, error) { + bbs := &BarcodesBarcodeEventsMixins{} + if err := c.SearchRead(BarcodesBarcodeEventsMixinModel, criteria, options, bbs); err != nil { + return nil, err + } + return bbs, nil +} + +// FindBarcodesBarcodeEventsMixinIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindBarcodesBarcodeEventsMixinIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(BarcodesBarcodeEventsMixinModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindBarcodesBarcodeEventsMixinId finds record id by querying it with criteria. +func (c *Client) FindBarcodesBarcodeEventsMixinId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(BarcodesBarcodeEventsMixinModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no barcodes.barcode_events_mixin was found with criteria %v and options %v", criteria, options) +} diff --git a/base.go b/base.go new file mode 100644 index 00000000..2c9653ee --- /dev/null +++ b/base.go @@ -0,0 +1,114 @@ +package odoo + +import ( + "fmt" +) + +// Base represents base model. +type Base struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` +} + +// Bases represents array of base model. +type Bases []Base + +// BaseModel is the odoo model name. +const BaseModel = "base" + +// Many2One convert Base to *Many2One. +func (b *Base) Many2One() *Many2One { + return NewMany2One(b.Id.Get(), "") +} + +// CreateBase creates a new base model and returns its id. +func (c *Client) CreateBase(b *Base) (int64, error) { + return c.Create(BaseModel, b) +} + +// UpdateBase updates an existing base record. +func (c *Client) UpdateBase(b *Base) error { + return c.UpdateBases([]int64{b.Id.Get()}, b) +} + +// UpdateBases updates existing base records. +// All records (represented by ids) will be updated by b values. +func (c *Client) UpdateBases(ids []int64, b *Base) error { + return c.Update(BaseModel, ids, b) +} + +// DeleteBase deletes an existing base record. +func (c *Client) DeleteBase(id int64) error { + return c.DeleteBases([]int64{id}) +} + +// DeleteBases deletes existing base records. +func (c *Client) DeleteBases(ids []int64) error { + return c.Delete(BaseModel, ids) +} + +// GetBase gets base existing record. +func (c *Client) GetBase(id int64) (*Base, error) { + bs, err := c.GetBases([]int64{id}) + if err != nil { + return nil, err + } + if bs != nil && len(*bs) > 0 { + return &((*bs)[0]), nil + } + return nil, fmt.Errorf("id %v of base not found", id) +} + +// GetBases gets base existing records. +func (c *Client) GetBases(ids []int64) (*Bases, error) { + bs := &Bases{} + if err := c.Read(BaseModel, ids, nil, bs); err != nil { + return nil, err + } + return bs, nil +} + +// FindBase finds base record by querying it with criteria. +func (c *Client) FindBase(criteria *Criteria) (*Base, error) { + bs := &Bases{} + if err := c.SearchRead(BaseModel, criteria, NewOptions().Limit(1), bs); err != nil { + return nil, err + } + if bs != nil && len(*bs) > 0 { + return &((*bs)[0]), nil + } + return nil, fmt.Errorf("no base was found with criteria %v", criteria) +} + +// FindBases finds base records by querying it +// and filtering it with criteria and options. +func (c *Client) FindBases(criteria *Criteria, options *Options) (*Bases, error) { + bs := &Bases{} + if err := c.SearchRead(BaseModel, criteria, options, bs); err != nil { + return nil, err + } + return bs, nil +} + +// FindBaseIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(BaseModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindBaseId finds record id by querying it with criteria. +func (c *Client) FindBaseId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(BaseModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no base was found with criteria %v and options %v", criteria, options) +} diff --git a/base_import_import.go b/base_import_import.go new file mode 100644 index 00000000..8db76358 --- /dev/null +++ b/base_import_import.go @@ -0,0 +1,122 @@ +package odoo + +import ( + "fmt" +) + +// BaseImportImport represents base_import.import model. +type BaseImportImport struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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) { + return c.Create(BaseImportImportModel, bi) +} + +// 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) +} + +// 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 + } + if bis != nil && len(*bis) > 0 { + return &((*bis)[0]), nil + } + return nil, fmt.Errorf("id %v of base_import.import not found", id) +} + +// 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 + } + if bis != nil && len(*bis) > 0 { + return &((*bis)[0]), nil + } + return nil, fmt.Errorf("no base_import.import was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(BaseImportImportModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no base_import.import was found with criteria %v and options %v", criteria, options) +} diff --git a/base_import_tests_models_char.go b/base_import_tests_models_char.go new file mode 100644 index 00000000..16124413 --- /dev/null +++ b/base_import_tests_models_char.go @@ -0,0 +1,119 @@ +package odoo + +import ( + "fmt" +) + +// BaseImportTestsModelsChar represents base_import.tests.models.char model. +type BaseImportTestsModelsChar struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Value *String `xmlrpc:"value,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// BaseImportTestsModelsChars represents array of base_import.tests.models.char model. +type BaseImportTestsModelsChars []BaseImportTestsModelsChar + +// BaseImportTestsModelsCharModel is the odoo model name. +const BaseImportTestsModelsCharModel = "base_import.tests.models.char" + +// Many2One convert BaseImportTestsModelsChar to *Many2One. +func (btmc *BaseImportTestsModelsChar) Many2One() *Many2One { + return NewMany2One(btmc.Id.Get(), "") +} + +// CreateBaseImportTestsModelsChar creates a new base_import.tests.models.char model and returns its id. +func (c *Client) CreateBaseImportTestsModelsChar(btmc *BaseImportTestsModelsChar) (int64, error) { + return c.Create(BaseImportTestsModelsCharModel, btmc) +} + +// UpdateBaseImportTestsModelsChar updates an existing base_import.tests.models.char record. +func (c *Client) UpdateBaseImportTestsModelsChar(btmc *BaseImportTestsModelsChar) error { + return c.UpdateBaseImportTestsModelsChars([]int64{btmc.Id.Get()}, btmc) +} + +// UpdateBaseImportTestsModelsChars updates existing base_import.tests.models.char records. +// All records (represented by ids) will be updated by btmc values. +func (c *Client) UpdateBaseImportTestsModelsChars(ids []int64, btmc *BaseImportTestsModelsChar) error { + return c.Update(BaseImportTestsModelsCharModel, ids, btmc) +} + +// DeleteBaseImportTestsModelsChar deletes an existing base_import.tests.models.char record. +func (c *Client) DeleteBaseImportTestsModelsChar(id int64) error { + return c.DeleteBaseImportTestsModelsChars([]int64{id}) +} + +// DeleteBaseImportTestsModelsChars deletes existing base_import.tests.models.char records. +func (c *Client) DeleteBaseImportTestsModelsChars(ids []int64) error { + return c.Delete(BaseImportTestsModelsCharModel, ids) +} + +// GetBaseImportTestsModelsChar gets base_import.tests.models.char existing record. +func (c *Client) GetBaseImportTestsModelsChar(id int64) (*BaseImportTestsModelsChar, error) { + btmcs, err := c.GetBaseImportTestsModelsChars([]int64{id}) + if err != nil { + return nil, err + } + if btmcs != nil && len(*btmcs) > 0 { + return &((*btmcs)[0]), nil + } + return nil, fmt.Errorf("id %v of base_import.tests.models.char not found", id) +} + +// GetBaseImportTestsModelsChars gets base_import.tests.models.char existing records. +func (c *Client) GetBaseImportTestsModelsChars(ids []int64) (*BaseImportTestsModelsChars, error) { + btmcs := &BaseImportTestsModelsChars{} + if err := c.Read(BaseImportTestsModelsCharModel, ids, nil, btmcs); err != nil { + return nil, err + } + return btmcs, nil +} + +// FindBaseImportTestsModelsChar finds base_import.tests.models.char record by querying it with criteria. +func (c *Client) FindBaseImportTestsModelsChar(criteria *Criteria) (*BaseImportTestsModelsChar, error) { + btmcs := &BaseImportTestsModelsChars{} + if err := c.SearchRead(BaseImportTestsModelsCharModel, criteria, NewOptions().Limit(1), btmcs); err != nil { + return nil, err + } + if btmcs != nil && len(*btmcs) > 0 { + return &((*btmcs)[0]), nil + } + return nil, fmt.Errorf("no base_import.tests.models.char was found with criteria %v", criteria) +} + +// FindBaseImportTestsModelsChars finds base_import.tests.models.char records by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseImportTestsModelsChars(criteria *Criteria, options *Options) (*BaseImportTestsModelsChars, error) { + btmcs := &BaseImportTestsModelsChars{} + if err := c.SearchRead(BaseImportTestsModelsCharModel, criteria, options, btmcs); err != nil { + return nil, err + } + return btmcs, nil +} + +// FindBaseImportTestsModelsCharIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseImportTestsModelsCharIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(BaseImportTestsModelsCharModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindBaseImportTestsModelsCharId finds record id by querying it with criteria. +func (c *Client) FindBaseImportTestsModelsCharId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(BaseImportTestsModelsCharModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no base_import.tests.models.char was found with criteria %v and options %v", criteria, options) +} diff --git a/base_import_tests_models_char_noreadonly.go b/base_import_tests_models_char_noreadonly.go new file mode 100644 index 00000000..8f5af7a7 --- /dev/null +++ b/base_import_tests_models_char_noreadonly.go @@ -0,0 +1,119 @@ +package odoo + +import ( + "fmt" +) + +// BaseImportTestsModelsCharNoreadonly represents base_import.tests.models.char.noreadonly model. +type BaseImportTestsModelsCharNoreadonly struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Value *String `xmlrpc:"value,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// BaseImportTestsModelsCharNoreadonlys represents array of base_import.tests.models.char.noreadonly model. +type BaseImportTestsModelsCharNoreadonlys []BaseImportTestsModelsCharNoreadonly + +// BaseImportTestsModelsCharNoreadonlyModel is the odoo model name. +const BaseImportTestsModelsCharNoreadonlyModel = "base_import.tests.models.char.noreadonly" + +// Many2One convert BaseImportTestsModelsCharNoreadonly to *Many2One. +func (btmcn *BaseImportTestsModelsCharNoreadonly) Many2One() *Many2One { + return NewMany2One(btmcn.Id.Get(), "") +} + +// CreateBaseImportTestsModelsCharNoreadonly creates a new base_import.tests.models.char.noreadonly model and returns its id. +func (c *Client) CreateBaseImportTestsModelsCharNoreadonly(btmcn *BaseImportTestsModelsCharNoreadonly) (int64, error) { + return c.Create(BaseImportTestsModelsCharNoreadonlyModel, btmcn) +} + +// UpdateBaseImportTestsModelsCharNoreadonly updates an existing base_import.tests.models.char.noreadonly record. +func (c *Client) UpdateBaseImportTestsModelsCharNoreadonly(btmcn *BaseImportTestsModelsCharNoreadonly) error { + return c.UpdateBaseImportTestsModelsCharNoreadonlys([]int64{btmcn.Id.Get()}, btmcn) +} + +// UpdateBaseImportTestsModelsCharNoreadonlys updates existing base_import.tests.models.char.noreadonly records. +// All records (represented by ids) will be updated by btmcn values. +func (c *Client) UpdateBaseImportTestsModelsCharNoreadonlys(ids []int64, btmcn *BaseImportTestsModelsCharNoreadonly) error { + return c.Update(BaseImportTestsModelsCharNoreadonlyModel, ids, btmcn) +} + +// DeleteBaseImportTestsModelsCharNoreadonly deletes an existing base_import.tests.models.char.noreadonly record. +func (c *Client) DeleteBaseImportTestsModelsCharNoreadonly(id int64) error { + return c.DeleteBaseImportTestsModelsCharNoreadonlys([]int64{id}) +} + +// DeleteBaseImportTestsModelsCharNoreadonlys deletes existing base_import.tests.models.char.noreadonly records. +func (c *Client) DeleteBaseImportTestsModelsCharNoreadonlys(ids []int64) error { + return c.Delete(BaseImportTestsModelsCharNoreadonlyModel, ids) +} + +// GetBaseImportTestsModelsCharNoreadonly gets base_import.tests.models.char.noreadonly existing record. +func (c *Client) GetBaseImportTestsModelsCharNoreadonly(id int64) (*BaseImportTestsModelsCharNoreadonly, error) { + btmcns, err := c.GetBaseImportTestsModelsCharNoreadonlys([]int64{id}) + if err != nil { + return nil, err + } + if btmcns != nil && len(*btmcns) > 0 { + return &((*btmcns)[0]), nil + } + return nil, fmt.Errorf("id %v of base_import.tests.models.char.noreadonly not found", id) +} + +// GetBaseImportTestsModelsCharNoreadonlys gets base_import.tests.models.char.noreadonly existing records. +func (c *Client) GetBaseImportTestsModelsCharNoreadonlys(ids []int64) (*BaseImportTestsModelsCharNoreadonlys, error) { + btmcns := &BaseImportTestsModelsCharNoreadonlys{} + if err := c.Read(BaseImportTestsModelsCharNoreadonlyModel, ids, nil, btmcns); err != nil { + return nil, err + } + return btmcns, nil +} + +// FindBaseImportTestsModelsCharNoreadonly finds base_import.tests.models.char.noreadonly record by querying it with criteria. +func (c *Client) FindBaseImportTestsModelsCharNoreadonly(criteria *Criteria) (*BaseImportTestsModelsCharNoreadonly, error) { + btmcns := &BaseImportTestsModelsCharNoreadonlys{} + if err := c.SearchRead(BaseImportTestsModelsCharNoreadonlyModel, criteria, NewOptions().Limit(1), btmcns); err != nil { + return nil, err + } + if btmcns != nil && len(*btmcns) > 0 { + return &((*btmcns)[0]), nil + } + return nil, fmt.Errorf("no base_import.tests.models.char.noreadonly was found with criteria %v", criteria) +} + +// FindBaseImportTestsModelsCharNoreadonlys finds base_import.tests.models.char.noreadonly records by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseImportTestsModelsCharNoreadonlys(criteria *Criteria, options *Options) (*BaseImportTestsModelsCharNoreadonlys, error) { + btmcns := &BaseImportTestsModelsCharNoreadonlys{} + if err := c.SearchRead(BaseImportTestsModelsCharNoreadonlyModel, criteria, options, btmcns); err != nil { + return nil, err + } + return btmcns, nil +} + +// FindBaseImportTestsModelsCharNoreadonlyIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseImportTestsModelsCharNoreadonlyIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(BaseImportTestsModelsCharNoreadonlyModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindBaseImportTestsModelsCharNoreadonlyId finds record id by querying it with criteria. +func (c *Client) FindBaseImportTestsModelsCharNoreadonlyId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(BaseImportTestsModelsCharNoreadonlyModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no base_import.tests.models.char.noreadonly was found with criteria %v and options %v", criteria, options) +} diff --git a/base_import_tests_models_char_readonly.go b/base_import_tests_models_char_readonly.go new file mode 100644 index 00000000..b37cb2d0 --- /dev/null +++ b/base_import_tests_models_char_readonly.go @@ -0,0 +1,119 @@ +package odoo + +import ( + "fmt" +) + +// BaseImportTestsModelsCharReadonly represents base_import.tests.models.char.readonly model. +type BaseImportTestsModelsCharReadonly struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Value *String `xmlrpc:"value,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// BaseImportTestsModelsCharReadonlys represents array of base_import.tests.models.char.readonly model. +type BaseImportTestsModelsCharReadonlys []BaseImportTestsModelsCharReadonly + +// BaseImportTestsModelsCharReadonlyModel is the odoo model name. +const BaseImportTestsModelsCharReadonlyModel = "base_import.tests.models.char.readonly" + +// Many2One convert BaseImportTestsModelsCharReadonly to *Many2One. +func (btmcr *BaseImportTestsModelsCharReadonly) Many2One() *Many2One { + return NewMany2One(btmcr.Id.Get(), "") +} + +// CreateBaseImportTestsModelsCharReadonly creates a new base_import.tests.models.char.readonly model and returns its id. +func (c *Client) CreateBaseImportTestsModelsCharReadonly(btmcr *BaseImportTestsModelsCharReadonly) (int64, error) { + return c.Create(BaseImportTestsModelsCharReadonlyModel, btmcr) +} + +// UpdateBaseImportTestsModelsCharReadonly updates an existing base_import.tests.models.char.readonly record. +func (c *Client) UpdateBaseImportTestsModelsCharReadonly(btmcr *BaseImportTestsModelsCharReadonly) error { + return c.UpdateBaseImportTestsModelsCharReadonlys([]int64{btmcr.Id.Get()}, btmcr) +} + +// UpdateBaseImportTestsModelsCharReadonlys updates existing base_import.tests.models.char.readonly records. +// All records (represented by ids) will be updated by btmcr values. +func (c *Client) UpdateBaseImportTestsModelsCharReadonlys(ids []int64, btmcr *BaseImportTestsModelsCharReadonly) error { + return c.Update(BaseImportTestsModelsCharReadonlyModel, ids, btmcr) +} + +// DeleteBaseImportTestsModelsCharReadonly deletes an existing base_import.tests.models.char.readonly record. +func (c *Client) DeleteBaseImportTestsModelsCharReadonly(id int64) error { + return c.DeleteBaseImportTestsModelsCharReadonlys([]int64{id}) +} + +// DeleteBaseImportTestsModelsCharReadonlys deletes existing base_import.tests.models.char.readonly records. +func (c *Client) DeleteBaseImportTestsModelsCharReadonlys(ids []int64) error { + return c.Delete(BaseImportTestsModelsCharReadonlyModel, ids) +} + +// GetBaseImportTestsModelsCharReadonly gets base_import.tests.models.char.readonly existing record. +func (c *Client) GetBaseImportTestsModelsCharReadonly(id int64) (*BaseImportTestsModelsCharReadonly, error) { + btmcrs, err := c.GetBaseImportTestsModelsCharReadonlys([]int64{id}) + if err != nil { + return nil, err + } + if btmcrs != nil && len(*btmcrs) > 0 { + return &((*btmcrs)[0]), nil + } + return nil, fmt.Errorf("id %v of base_import.tests.models.char.readonly not found", id) +} + +// GetBaseImportTestsModelsCharReadonlys gets base_import.tests.models.char.readonly existing records. +func (c *Client) GetBaseImportTestsModelsCharReadonlys(ids []int64) (*BaseImportTestsModelsCharReadonlys, error) { + btmcrs := &BaseImportTestsModelsCharReadonlys{} + if err := c.Read(BaseImportTestsModelsCharReadonlyModel, ids, nil, btmcrs); err != nil { + return nil, err + } + return btmcrs, nil +} + +// FindBaseImportTestsModelsCharReadonly finds base_import.tests.models.char.readonly record by querying it with criteria. +func (c *Client) FindBaseImportTestsModelsCharReadonly(criteria *Criteria) (*BaseImportTestsModelsCharReadonly, error) { + btmcrs := &BaseImportTestsModelsCharReadonlys{} + if err := c.SearchRead(BaseImportTestsModelsCharReadonlyModel, criteria, NewOptions().Limit(1), btmcrs); err != nil { + return nil, err + } + if btmcrs != nil && len(*btmcrs) > 0 { + return &((*btmcrs)[0]), nil + } + return nil, fmt.Errorf("no base_import.tests.models.char.readonly was found with criteria %v", criteria) +} + +// FindBaseImportTestsModelsCharReadonlys finds base_import.tests.models.char.readonly records by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseImportTestsModelsCharReadonlys(criteria *Criteria, options *Options) (*BaseImportTestsModelsCharReadonlys, error) { + btmcrs := &BaseImportTestsModelsCharReadonlys{} + if err := c.SearchRead(BaseImportTestsModelsCharReadonlyModel, criteria, options, btmcrs); err != nil { + return nil, err + } + return btmcrs, nil +} + +// FindBaseImportTestsModelsCharReadonlyIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseImportTestsModelsCharReadonlyIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(BaseImportTestsModelsCharReadonlyModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindBaseImportTestsModelsCharReadonlyId finds record id by querying it with criteria. +func (c *Client) FindBaseImportTestsModelsCharReadonlyId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(BaseImportTestsModelsCharReadonlyModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no base_import.tests.models.char.readonly was found with criteria %v and options %v", criteria, options) +} diff --git a/base_import_tests_models_char_required.go b/base_import_tests_models_char_required.go new file mode 100644 index 00000000..0383b5ba --- /dev/null +++ b/base_import_tests_models_char_required.go @@ -0,0 +1,119 @@ +package odoo + +import ( + "fmt" +) + +// BaseImportTestsModelsCharRequired represents base_import.tests.models.char.required model. +type BaseImportTestsModelsCharRequired struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Value *String `xmlrpc:"value,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// BaseImportTestsModelsCharRequireds represents array of base_import.tests.models.char.required model. +type BaseImportTestsModelsCharRequireds []BaseImportTestsModelsCharRequired + +// BaseImportTestsModelsCharRequiredModel is the odoo model name. +const BaseImportTestsModelsCharRequiredModel = "base_import.tests.models.char.required" + +// Many2One convert BaseImportTestsModelsCharRequired to *Many2One. +func (btmcr *BaseImportTestsModelsCharRequired) Many2One() *Many2One { + return NewMany2One(btmcr.Id.Get(), "") +} + +// CreateBaseImportTestsModelsCharRequired creates a new base_import.tests.models.char.required model and returns its id. +func (c *Client) CreateBaseImportTestsModelsCharRequired(btmcr *BaseImportTestsModelsCharRequired) (int64, error) { + return c.Create(BaseImportTestsModelsCharRequiredModel, btmcr) +} + +// UpdateBaseImportTestsModelsCharRequired updates an existing base_import.tests.models.char.required record. +func (c *Client) UpdateBaseImportTestsModelsCharRequired(btmcr *BaseImportTestsModelsCharRequired) error { + return c.UpdateBaseImportTestsModelsCharRequireds([]int64{btmcr.Id.Get()}, btmcr) +} + +// UpdateBaseImportTestsModelsCharRequireds updates existing base_import.tests.models.char.required records. +// All records (represented by ids) will be updated by btmcr values. +func (c *Client) UpdateBaseImportTestsModelsCharRequireds(ids []int64, btmcr *BaseImportTestsModelsCharRequired) error { + return c.Update(BaseImportTestsModelsCharRequiredModel, ids, btmcr) +} + +// DeleteBaseImportTestsModelsCharRequired deletes an existing base_import.tests.models.char.required record. +func (c *Client) DeleteBaseImportTestsModelsCharRequired(id int64) error { + return c.DeleteBaseImportTestsModelsCharRequireds([]int64{id}) +} + +// DeleteBaseImportTestsModelsCharRequireds deletes existing base_import.tests.models.char.required records. +func (c *Client) DeleteBaseImportTestsModelsCharRequireds(ids []int64) error { + return c.Delete(BaseImportTestsModelsCharRequiredModel, ids) +} + +// GetBaseImportTestsModelsCharRequired gets base_import.tests.models.char.required existing record. +func (c *Client) GetBaseImportTestsModelsCharRequired(id int64) (*BaseImportTestsModelsCharRequired, error) { + btmcrs, err := c.GetBaseImportTestsModelsCharRequireds([]int64{id}) + if err != nil { + return nil, err + } + if btmcrs != nil && len(*btmcrs) > 0 { + return &((*btmcrs)[0]), nil + } + return nil, fmt.Errorf("id %v of base_import.tests.models.char.required not found", id) +} + +// GetBaseImportTestsModelsCharRequireds gets base_import.tests.models.char.required existing records. +func (c *Client) GetBaseImportTestsModelsCharRequireds(ids []int64) (*BaseImportTestsModelsCharRequireds, error) { + btmcrs := &BaseImportTestsModelsCharRequireds{} + if err := c.Read(BaseImportTestsModelsCharRequiredModel, ids, nil, btmcrs); err != nil { + return nil, err + } + return btmcrs, nil +} + +// FindBaseImportTestsModelsCharRequired finds base_import.tests.models.char.required record by querying it with criteria. +func (c *Client) FindBaseImportTestsModelsCharRequired(criteria *Criteria) (*BaseImportTestsModelsCharRequired, error) { + btmcrs := &BaseImportTestsModelsCharRequireds{} + if err := c.SearchRead(BaseImportTestsModelsCharRequiredModel, criteria, NewOptions().Limit(1), btmcrs); err != nil { + return nil, err + } + if btmcrs != nil && len(*btmcrs) > 0 { + return &((*btmcrs)[0]), nil + } + return nil, fmt.Errorf("no base_import.tests.models.char.required was found with criteria %v", criteria) +} + +// FindBaseImportTestsModelsCharRequireds finds base_import.tests.models.char.required records by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseImportTestsModelsCharRequireds(criteria *Criteria, options *Options) (*BaseImportTestsModelsCharRequireds, error) { + btmcrs := &BaseImportTestsModelsCharRequireds{} + if err := c.SearchRead(BaseImportTestsModelsCharRequiredModel, criteria, options, btmcrs); err != nil { + return nil, err + } + return btmcrs, nil +} + +// FindBaseImportTestsModelsCharRequiredIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseImportTestsModelsCharRequiredIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(BaseImportTestsModelsCharRequiredModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindBaseImportTestsModelsCharRequiredId finds record id by querying it with criteria. +func (c *Client) FindBaseImportTestsModelsCharRequiredId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(BaseImportTestsModelsCharRequiredModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no base_import.tests.models.char.required was found with criteria %v and options %v", criteria, options) +} diff --git a/base_import_tests_models_char_states.go b/base_import_tests_models_char_states.go new file mode 100644 index 00000000..bde27a88 --- /dev/null +++ b/base_import_tests_models_char_states.go @@ -0,0 +1,119 @@ +package odoo + +import ( + "fmt" +) + +// BaseImportTestsModelsCharStates represents base_import.tests.models.char.states model. +type BaseImportTestsModelsCharStates struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Value *String `xmlrpc:"value,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// BaseImportTestsModelsCharStatess represents array of base_import.tests.models.char.states model. +type BaseImportTestsModelsCharStatess []BaseImportTestsModelsCharStates + +// BaseImportTestsModelsCharStatesModel is the odoo model name. +const BaseImportTestsModelsCharStatesModel = "base_import.tests.models.char.states" + +// Many2One convert BaseImportTestsModelsCharStates to *Many2One. +func (btmcs *BaseImportTestsModelsCharStates) Many2One() *Many2One { + return NewMany2One(btmcs.Id.Get(), "") +} + +// CreateBaseImportTestsModelsCharStates creates a new base_import.tests.models.char.states model and returns its id. +func (c *Client) CreateBaseImportTestsModelsCharStates(btmcs *BaseImportTestsModelsCharStates) (int64, error) { + return c.Create(BaseImportTestsModelsCharStatesModel, btmcs) +} + +// UpdateBaseImportTestsModelsCharStates updates an existing base_import.tests.models.char.states record. +func (c *Client) UpdateBaseImportTestsModelsCharStates(btmcs *BaseImportTestsModelsCharStates) error { + return c.UpdateBaseImportTestsModelsCharStatess([]int64{btmcs.Id.Get()}, btmcs) +} + +// UpdateBaseImportTestsModelsCharStatess updates existing base_import.tests.models.char.states records. +// All records (represented by ids) will be updated by btmcs values. +func (c *Client) UpdateBaseImportTestsModelsCharStatess(ids []int64, btmcs *BaseImportTestsModelsCharStates) error { + return c.Update(BaseImportTestsModelsCharStatesModel, ids, btmcs) +} + +// DeleteBaseImportTestsModelsCharStates deletes an existing base_import.tests.models.char.states record. +func (c *Client) DeleteBaseImportTestsModelsCharStates(id int64) error { + return c.DeleteBaseImportTestsModelsCharStatess([]int64{id}) +} + +// DeleteBaseImportTestsModelsCharStatess deletes existing base_import.tests.models.char.states records. +func (c *Client) DeleteBaseImportTestsModelsCharStatess(ids []int64) error { + return c.Delete(BaseImportTestsModelsCharStatesModel, ids) +} + +// GetBaseImportTestsModelsCharStates gets base_import.tests.models.char.states existing record. +func (c *Client) GetBaseImportTestsModelsCharStates(id int64) (*BaseImportTestsModelsCharStates, error) { + btmcss, err := c.GetBaseImportTestsModelsCharStatess([]int64{id}) + if err != nil { + return nil, err + } + if btmcss != nil && len(*btmcss) > 0 { + return &((*btmcss)[0]), nil + } + return nil, fmt.Errorf("id %v of base_import.tests.models.char.states not found", id) +} + +// GetBaseImportTestsModelsCharStatess gets base_import.tests.models.char.states existing records. +func (c *Client) GetBaseImportTestsModelsCharStatess(ids []int64) (*BaseImportTestsModelsCharStatess, error) { + btmcss := &BaseImportTestsModelsCharStatess{} + if err := c.Read(BaseImportTestsModelsCharStatesModel, ids, nil, btmcss); err != nil { + return nil, err + } + return btmcss, nil +} + +// FindBaseImportTestsModelsCharStates finds base_import.tests.models.char.states record by querying it with criteria. +func (c *Client) FindBaseImportTestsModelsCharStates(criteria *Criteria) (*BaseImportTestsModelsCharStates, error) { + btmcss := &BaseImportTestsModelsCharStatess{} + if err := c.SearchRead(BaseImportTestsModelsCharStatesModel, criteria, NewOptions().Limit(1), btmcss); err != nil { + return nil, err + } + if btmcss != nil && len(*btmcss) > 0 { + return &((*btmcss)[0]), nil + } + return nil, fmt.Errorf("no base_import.tests.models.char.states was found with criteria %v", criteria) +} + +// FindBaseImportTestsModelsCharStatess finds base_import.tests.models.char.states records by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseImportTestsModelsCharStatess(criteria *Criteria, options *Options) (*BaseImportTestsModelsCharStatess, error) { + btmcss := &BaseImportTestsModelsCharStatess{} + if err := c.SearchRead(BaseImportTestsModelsCharStatesModel, criteria, options, btmcss); err != nil { + return nil, err + } + return btmcss, nil +} + +// FindBaseImportTestsModelsCharStatesIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseImportTestsModelsCharStatesIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(BaseImportTestsModelsCharStatesModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindBaseImportTestsModelsCharStatesId finds record id by querying it with criteria. +func (c *Client) FindBaseImportTestsModelsCharStatesId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(BaseImportTestsModelsCharStatesModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no base_import.tests.models.char.states was found with criteria %v and options %v", criteria, options) +} diff --git a/base_import_tests_models_char_stillreadonly.go b/base_import_tests_models_char_stillreadonly.go new file mode 100644 index 00000000..9cb536d7 --- /dev/null +++ b/base_import_tests_models_char_stillreadonly.go @@ -0,0 +1,119 @@ +package odoo + +import ( + "fmt" +) + +// BaseImportTestsModelsCharStillreadonly represents base_import.tests.models.char.stillreadonly model. +type BaseImportTestsModelsCharStillreadonly struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Value *String `xmlrpc:"value,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// BaseImportTestsModelsCharStillreadonlys represents array of base_import.tests.models.char.stillreadonly model. +type BaseImportTestsModelsCharStillreadonlys []BaseImportTestsModelsCharStillreadonly + +// BaseImportTestsModelsCharStillreadonlyModel is the odoo model name. +const BaseImportTestsModelsCharStillreadonlyModel = "base_import.tests.models.char.stillreadonly" + +// Many2One convert BaseImportTestsModelsCharStillreadonly to *Many2One. +func (btmcs *BaseImportTestsModelsCharStillreadonly) Many2One() *Many2One { + return NewMany2One(btmcs.Id.Get(), "") +} + +// CreateBaseImportTestsModelsCharStillreadonly creates a new base_import.tests.models.char.stillreadonly model and returns its id. +func (c *Client) CreateBaseImportTestsModelsCharStillreadonly(btmcs *BaseImportTestsModelsCharStillreadonly) (int64, error) { + return c.Create(BaseImportTestsModelsCharStillreadonlyModel, btmcs) +} + +// UpdateBaseImportTestsModelsCharStillreadonly updates an existing base_import.tests.models.char.stillreadonly record. +func (c *Client) UpdateBaseImportTestsModelsCharStillreadonly(btmcs *BaseImportTestsModelsCharStillreadonly) error { + return c.UpdateBaseImportTestsModelsCharStillreadonlys([]int64{btmcs.Id.Get()}, btmcs) +} + +// UpdateBaseImportTestsModelsCharStillreadonlys updates existing base_import.tests.models.char.stillreadonly records. +// All records (represented by ids) will be updated by btmcs values. +func (c *Client) UpdateBaseImportTestsModelsCharStillreadonlys(ids []int64, btmcs *BaseImportTestsModelsCharStillreadonly) error { + return c.Update(BaseImportTestsModelsCharStillreadonlyModel, ids, btmcs) +} + +// DeleteBaseImportTestsModelsCharStillreadonly deletes an existing base_import.tests.models.char.stillreadonly record. +func (c *Client) DeleteBaseImportTestsModelsCharStillreadonly(id int64) error { + return c.DeleteBaseImportTestsModelsCharStillreadonlys([]int64{id}) +} + +// DeleteBaseImportTestsModelsCharStillreadonlys deletes existing base_import.tests.models.char.stillreadonly records. +func (c *Client) DeleteBaseImportTestsModelsCharStillreadonlys(ids []int64) error { + return c.Delete(BaseImportTestsModelsCharStillreadonlyModel, ids) +} + +// GetBaseImportTestsModelsCharStillreadonly gets base_import.tests.models.char.stillreadonly existing record. +func (c *Client) GetBaseImportTestsModelsCharStillreadonly(id int64) (*BaseImportTestsModelsCharStillreadonly, error) { + btmcss, err := c.GetBaseImportTestsModelsCharStillreadonlys([]int64{id}) + if err != nil { + return nil, err + } + if btmcss != nil && len(*btmcss) > 0 { + return &((*btmcss)[0]), nil + } + return nil, fmt.Errorf("id %v of base_import.tests.models.char.stillreadonly not found", id) +} + +// GetBaseImportTestsModelsCharStillreadonlys gets base_import.tests.models.char.stillreadonly existing records. +func (c *Client) GetBaseImportTestsModelsCharStillreadonlys(ids []int64) (*BaseImportTestsModelsCharStillreadonlys, error) { + btmcss := &BaseImportTestsModelsCharStillreadonlys{} + if err := c.Read(BaseImportTestsModelsCharStillreadonlyModel, ids, nil, btmcss); err != nil { + return nil, err + } + return btmcss, nil +} + +// FindBaseImportTestsModelsCharStillreadonly finds base_import.tests.models.char.stillreadonly record by querying it with criteria. +func (c *Client) FindBaseImportTestsModelsCharStillreadonly(criteria *Criteria) (*BaseImportTestsModelsCharStillreadonly, error) { + btmcss := &BaseImportTestsModelsCharStillreadonlys{} + if err := c.SearchRead(BaseImportTestsModelsCharStillreadonlyModel, criteria, NewOptions().Limit(1), btmcss); err != nil { + return nil, err + } + if btmcss != nil && len(*btmcss) > 0 { + return &((*btmcss)[0]), nil + } + return nil, fmt.Errorf("no base_import.tests.models.char.stillreadonly was found with criteria %v", criteria) +} + +// FindBaseImportTestsModelsCharStillreadonlys finds base_import.tests.models.char.stillreadonly records by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseImportTestsModelsCharStillreadonlys(criteria *Criteria, options *Options) (*BaseImportTestsModelsCharStillreadonlys, error) { + btmcss := &BaseImportTestsModelsCharStillreadonlys{} + if err := c.SearchRead(BaseImportTestsModelsCharStillreadonlyModel, criteria, options, btmcss); err != nil { + return nil, err + } + return btmcss, nil +} + +// FindBaseImportTestsModelsCharStillreadonlyIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseImportTestsModelsCharStillreadonlyIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(BaseImportTestsModelsCharStillreadonlyModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindBaseImportTestsModelsCharStillreadonlyId finds record id by querying it with criteria. +func (c *Client) FindBaseImportTestsModelsCharStillreadonlyId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(BaseImportTestsModelsCharStillreadonlyModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no base_import.tests.models.char.stillreadonly was found with criteria %v and options %v", criteria, options) +} diff --git a/base_import_tests_models_m2o.go b/base_import_tests_models_m2o.go new file mode 100644 index 00000000..d1be64bd --- /dev/null +++ b/base_import_tests_models_m2o.go @@ -0,0 +1,119 @@ +package odoo + +import ( + "fmt" +) + +// BaseImportTestsModelsM2O represents base_import.tests.models.m2o model. +type BaseImportTestsModelsM2O struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Value *Many2One `xmlrpc:"value,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// BaseImportTestsModelsM2Os represents array of base_import.tests.models.m2o model. +type BaseImportTestsModelsM2Os []BaseImportTestsModelsM2O + +// BaseImportTestsModelsM2OModel is the odoo model name. +const BaseImportTestsModelsM2OModel = "base_import.tests.models.m2o" + +// Many2One convert BaseImportTestsModelsM2O to *Many2One. +func (btmm *BaseImportTestsModelsM2O) Many2One() *Many2One { + return NewMany2One(btmm.Id.Get(), "") +} + +// CreateBaseImportTestsModelsM2O creates a new base_import.tests.models.m2o model and returns its id. +func (c *Client) CreateBaseImportTestsModelsM2O(btmm *BaseImportTestsModelsM2O) (int64, error) { + return c.Create(BaseImportTestsModelsM2OModel, btmm) +} + +// UpdateBaseImportTestsModelsM2O updates an existing base_import.tests.models.m2o record. +func (c *Client) UpdateBaseImportTestsModelsM2O(btmm *BaseImportTestsModelsM2O) error { + return c.UpdateBaseImportTestsModelsM2Os([]int64{btmm.Id.Get()}, btmm) +} + +// UpdateBaseImportTestsModelsM2Os updates existing base_import.tests.models.m2o records. +// All records (represented by ids) will be updated by btmm values. +func (c *Client) UpdateBaseImportTestsModelsM2Os(ids []int64, btmm *BaseImportTestsModelsM2O) error { + return c.Update(BaseImportTestsModelsM2OModel, ids, btmm) +} + +// DeleteBaseImportTestsModelsM2O deletes an existing base_import.tests.models.m2o record. +func (c *Client) DeleteBaseImportTestsModelsM2O(id int64) error { + return c.DeleteBaseImportTestsModelsM2Os([]int64{id}) +} + +// DeleteBaseImportTestsModelsM2Os deletes existing base_import.tests.models.m2o records. +func (c *Client) DeleteBaseImportTestsModelsM2Os(ids []int64) error { + return c.Delete(BaseImportTestsModelsM2OModel, ids) +} + +// GetBaseImportTestsModelsM2O gets base_import.tests.models.m2o existing record. +func (c *Client) GetBaseImportTestsModelsM2O(id int64) (*BaseImportTestsModelsM2O, error) { + btmms, err := c.GetBaseImportTestsModelsM2Os([]int64{id}) + if err != nil { + return nil, err + } + if btmms != nil && len(*btmms) > 0 { + return &((*btmms)[0]), nil + } + return nil, fmt.Errorf("id %v of base_import.tests.models.m2o not found", id) +} + +// GetBaseImportTestsModelsM2Os gets base_import.tests.models.m2o existing records. +func (c *Client) GetBaseImportTestsModelsM2Os(ids []int64) (*BaseImportTestsModelsM2Os, error) { + btmms := &BaseImportTestsModelsM2Os{} + if err := c.Read(BaseImportTestsModelsM2OModel, ids, nil, btmms); err != nil { + return nil, err + } + return btmms, nil +} + +// FindBaseImportTestsModelsM2O finds base_import.tests.models.m2o record by querying it with criteria. +func (c *Client) FindBaseImportTestsModelsM2O(criteria *Criteria) (*BaseImportTestsModelsM2O, error) { + btmms := &BaseImportTestsModelsM2Os{} + if err := c.SearchRead(BaseImportTestsModelsM2OModel, criteria, NewOptions().Limit(1), btmms); err != nil { + return nil, err + } + if btmms != nil && len(*btmms) > 0 { + return &((*btmms)[0]), nil + } + return nil, fmt.Errorf("no base_import.tests.models.m2o was found with criteria %v", criteria) +} + +// FindBaseImportTestsModelsM2Os finds base_import.tests.models.m2o records by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseImportTestsModelsM2Os(criteria *Criteria, options *Options) (*BaseImportTestsModelsM2Os, error) { + btmms := &BaseImportTestsModelsM2Os{} + if err := c.SearchRead(BaseImportTestsModelsM2OModel, criteria, options, btmms); err != nil { + return nil, err + } + return btmms, nil +} + +// FindBaseImportTestsModelsM2OIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseImportTestsModelsM2OIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(BaseImportTestsModelsM2OModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindBaseImportTestsModelsM2OId finds record id by querying it with criteria. +func (c *Client) FindBaseImportTestsModelsM2OId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(BaseImportTestsModelsM2OModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no base_import.tests.models.m2o was found with criteria %v and options %v", criteria, options) +} diff --git a/base_import_tests_models_m2o_related.go b/base_import_tests_models_m2o_related.go new file mode 100644 index 00000000..c0945118 --- /dev/null +++ b/base_import_tests_models_m2o_related.go @@ -0,0 +1,119 @@ +package odoo + +import ( + "fmt" +) + +// BaseImportTestsModelsM2ORelated represents base_import.tests.models.m2o.related model. +type BaseImportTestsModelsM2ORelated struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Value *Int `xmlrpc:"value,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// BaseImportTestsModelsM2ORelateds represents array of base_import.tests.models.m2o.related model. +type BaseImportTestsModelsM2ORelateds []BaseImportTestsModelsM2ORelated + +// BaseImportTestsModelsM2ORelatedModel is the odoo model name. +const BaseImportTestsModelsM2ORelatedModel = "base_import.tests.models.m2o.related" + +// Many2One convert BaseImportTestsModelsM2ORelated to *Many2One. +func (btmmr *BaseImportTestsModelsM2ORelated) Many2One() *Many2One { + return NewMany2One(btmmr.Id.Get(), "") +} + +// CreateBaseImportTestsModelsM2ORelated creates a new base_import.tests.models.m2o.related model and returns its id. +func (c *Client) CreateBaseImportTestsModelsM2ORelated(btmmr *BaseImportTestsModelsM2ORelated) (int64, error) { + return c.Create(BaseImportTestsModelsM2ORelatedModel, btmmr) +} + +// UpdateBaseImportTestsModelsM2ORelated updates an existing base_import.tests.models.m2o.related record. +func (c *Client) UpdateBaseImportTestsModelsM2ORelated(btmmr *BaseImportTestsModelsM2ORelated) error { + return c.UpdateBaseImportTestsModelsM2ORelateds([]int64{btmmr.Id.Get()}, btmmr) +} + +// UpdateBaseImportTestsModelsM2ORelateds updates existing base_import.tests.models.m2o.related records. +// All records (represented by ids) will be updated by btmmr values. +func (c *Client) UpdateBaseImportTestsModelsM2ORelateds(ids []int64, btmmr *BaseImportTestsModelsM2ORelated) error { + return c.Update(BaseImportTestsModelsM2ORelatedModel, ids, btmmr) +} + +// DeleteBaseImportTestsModelsM2ORelated deletes an existing base_import.tests.models.m2o.related record. +func (c *Client) DeleteBaseImportTestsModelsM2ORelated(id int64) error { + return c.DeleteBaseImportTestsModelsM2ORelateds([]int64{id}) +} + +// DeleteBaseImportTestsModelsM2ORelateds deletes existing base_import.tests.models.m2o.related records. +func (c *Client) DeleteBaseImportTestsModelsM2ORelateds(ids []int64) error { + return c.Delete(BaseImportTestsModelsM2ORelatedModel, ids) +} + +// GetBaseImportTestsModelsM2ORelated gets base_import.tests.models.m2o.related existing record. +func (c *Client) GetBaseImportTestsModelsM2ORelated(id int64) (*BaseImportTestsModelsM2ORelated, error) { + btmmrs, err := c.GetBaseImportTestsModelsM2ORelateds([]int64{id}) + if err != nil { + return nil, err + } + if btmmrs != nil && len(*btmmrs) > 0 { + return &((*btmmrs)[0]), nil + } + return nil, fmt.Errorf("id %v of base_import.tests.models.m2o.related not found", id) +} + +// GetBaseImportTestsModelsM2ORelateds gets base_import.tests.models.m2o.related existing records. +func (c *Client) GetBaseImportTestsModelsM2ORelateds(ids []int64) (*BaseImportTestsModelsM2ORelateds, error) { + btmmrs := &BaseImportTestsModelsM2ORelateds{} + if err := c.Read(BaseImportTestsModelsM2ORelatedModel, ids, nil, btmmrs); err != nil { + return nil, err + } + return btmmrs, nil +} + +// FindBaseImportTestsModelsM2ORelated finds base_import.tests.models.m2o.related record by querying it with criteria. +func (c *Client) FindBaseImportTestsModelsM2ORelated(criteria *Criteria) (*BaseImportTestsModelsM2ORelated, error) { + btmmrs := &BaseImportTestsModelsM2ORelateds{} + if err := c.SearchRead(BaseImportTestsModelsM2ORelatedModel, criteria, NewOptions().Limit(1), btmmrs); err != nil { + return nil, err + } + if btmmrs != nil && len(*btmmrs) > 0 { + return &((*btmmrs)[0]), nil + } + return nil, fmt.Errorf("no base_import.tests.models.m2o.related was found with criteria %v", criteria) +} + +// FindBaseImportTestsModelsM2ORelateds finds base_import.tests.models.m2o.related records by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseImportTestsModelsM2ORelateds(criteria *Criteria, options *Options) (*BaseImportTestsModelsM2ORelateds, error) { + btmmrs := &BaseImportTestsModelsM2ORelateds{} + if err := c.SearchRead(BaseImportTestsModelsM2ORelatedModel, criteria, options, btmmrs); err != nil { + return nil, err + } + return btmmrs, nil +} + +// FindBaseImportTestsModelsM2ORelatedIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseImportTestsModelsM2ORelatedIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(BaseImportTestsModelsM2ORelatedModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindBaseImportTestsModelsM2ORelatedId finds record id by querying it with criteria. +func (c *Client) FindBaseImportTestsModelsM2ORelatedId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(BaseImportTestsModelsM2ORelatedModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no base_import.tests.models.m2o.related was found with criteria %v and options %v", criteria, options) +} diff --git a/base_import_tests_models_m2o_required.go b/base_import_tests_models_m2o_required.go new file mode 100644 index 00000000..67b05a53 --- /dev/null +++ b/base_import_tests_models_m2o_required.go @@ -0,0 +1,119 @@ +package odoo + +import ( + "fmt" +) + +// BaseImportTestsModelsM2ORequired represents base_import.tests.models.m2o.required model. +type BaseImportTestsModelsM2ORequired struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Value *Many2One `xmlrpc:"value,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// BaseImportTestsModelsM2ORequireds represents array of base_import.tests.models.m2o.required model. +type BaseImportTestsModelsM2ORequireds []BaseImportTestsModelsM2ORequired + +// BaseImportTestsModelsM2ORequiredModel is the odoo model name. +const BaseImportTestsModelsM2ORequiredModel = "base_import.tests.models.m2o.required" + +// Many2One convert BaseImportTestsModelsM2ORequired to *Many2One. +func (btmmr *BaseImportTestsModelsM2ORequired) Many2One() *Many2One { + return NewMany2One(btmmr.Id.Get(), "") +} + +// CreateBaseImportTestsModelsM2ORequired creates a new base_import.tests.models.m2o.required model and returns its id. +func (c *Client) CreateBaseImportTestsModelsM2ORequired(btmmr *BaseImportTestsModelsM2ORequired) (int64, error) { + return c.Create(BaseImportTestsModelsM2ORequiredModel, btmmr) +} + +// UpdateBaseImportTestsModelsM2ORequired updates an existing base_import.tests.models.m2o.required record. +func (c *Client) UpdateBaseImportTestsModelsM2ORequired(btmmr *BaseImportTestsModelsM2ORequired) error { + return c.UpdateBaseImportTestsModelsM2ORequireds([]int64{btmmr.Id.Get()}, btmmr) +} + +// UpdateBaseImportTestsModelsM2ORequireds updates existing base_import.tests.models.m2o.required records. +// All records (represented by ids) will be updated by btmmr values. +func (c *Client) UpdateBaseImportTestsModelsM2ORequireds(ids []int64, btmmr *BaseImportTestsModelsM2ORequired) error { + return c.Update(BaseImportTestsModelsM2ORequiredModel, ids, btmmr) +} + +// DeleteBaseImportTestsModelsM2ORequired deletes an existing base_import.tests.models.m2o.required record. +func (c *Client) DeleteBaseImportTestsModelsM2ORequired(id int64) error { + return c.DeleteBaseImportTestsModelsM2ORequireds([]int64{id}) +} + +// DeleteBaseImportTestsModelsM2ORequireds deletes existing base_import.tests.models.m2o.required records. +func (c *Client) DeleteBaseImportTestsModelsM2ORequireds(ids []int64) error { + return c.Delete(BaseImportTestsModelsM2ORequiredModel, ids) +} + +// GetBaseImportTestsModelsM2ORequired gets base_import.tests.models.m2o.required existing record. +func (c *Client) GetBaseImportTestsModelsM2ORequired(id int64) (*BaseImportTestsModelsM2ORequired, error) { + btmmrs, err := c.GetBaseImportTestsModelsM2ORequireds([]int64{id}) + if err != nil { + return nil, err + } + if btmmrs != nil && len(*btmmrs) > 0 { + return &((*btmmrs)[0]), nil + } + return nil, fmt.Errorf("id %v of base_import.tests.models.m2o.required not found", id) +} + +// GetBaseImportTestsModelsM2ORequireds gets base_import.tests.models.m2o.required existing records. +func (c *Client) GetBaseImportTestsModelsM2ORequireds(ids []int64) (*BaseImportTestsModelsM2ORequireds, error) { + btmmrs := &BaseImportTestsModelsM2ORequireds{} + if err := c.Read(BaseImportTestsModelsM2ORequiredModel, ids, nil, btmmrs); err != nil { + return nil, err + } + return btmmrs, nil +} + +// FindBaseImportTestsModelsM2ORequired finds base_import.tests.models.m2o.required record by querying it with criteria. +func (c *Client) FindBaseImportTestsModelsM2ORequired(criteria *Criteria) (*BaseImportTestsModelsM2ORequired, error) { + btmmrs := &BaseImportTestsModelsM2ORequireds{} + if err := c.SearchRead(BaseImportTestsModelsM2ORequiredModel, criteria, NewOptions().Limit(1), btmmrs); err != nil { + return nil, err + } + if btmmrs != nil && len(*btmmrs) > 0 { + return &((*btmmrs)[0]), nil + } + return nil, fmt.Errorf("no base_import.tests.models.m2o.required was found with criteria %v", criteria) +} + +// FindBaseImportTestsModelsM2ORequireds finds base_import.tests.models.m2o.required records by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseImportTestsModelsM2ORequireds(criteria *Criteria, options *Options) (*BaseImportTestsModelsM2ORequireds, error) { + btmmrs := &BaseImportTestsModelsM2ORequireds{} + if err := c.SearchRead(BaseImportTestsModelsM2ORequiredModel, criteria, options, btmmrs); err != nil { + return nil, err + } + return btmmrs, nil +} + +// FindBaseImportTestsModelsM2ORequiredIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseImportTestsModelsM2ORequiredIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(BaseImportTestsModelsM2ORequiredModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindBaseImportTestsModelsM2ORequiredId finds record id by querying it with criteria. +func (c *Client) FindBaseImportTestsModelsM2ORequiredId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(BaseImportTestsModelsM2ORequiredModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no base_import.tests.models.m2o.required was found with criteria %v and options %v", criteria, options) +} diff --git a/base_import_tests_models_m2o_required_related.go b/base_import_tests_models_m2o_required_related.go new file mode 100644 index 00000000..43126933 --- /dev/null +++ b/base_import_tests_models_m2o_required_related.go @@ -0,0 +1,119 @@ +package odoo + +import ( + "fmt" +) + +// BaseImportTestsModelsM2ORequiredRelated represents base_import.tests.models.m2o.required.related model. +type BaseImportTestsModelsM2ORequiredRelated struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Value *Int `xmlrpc:"value,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// BaseImportTestsModelsM2ORequiredRelateds represents array of base_import.tests.models.m2o.required.related model. +type BaseImportTestsModelsM2ORequiredRelateds []BaseImportTestsModelsM2ORequiredRelated + +// BaseImportTestsModelsM2ORequiredRelatedModel is the odoo model name. +const BaseImportTestsModelsM2ORequiredRelatedModel = "base_import.tests.models.m2o.required.related" + +// Many2One convert BaseImportTestsModelsM2ORequiredRelated to *Many2One. +func (btmmrr *BaseImportTestsModelsM2ORequiredRelated) Many2One() *Many2One { + return NewMany2One(btmmrr.Id.Get(), "") +} + +// CreateBaseImportTestsModelsM2ORequiredRelated creates a new base_import.tests.models.m2o.required.related model and returns its id. +func (c *Client) CreateBaseImportTestsModelsM2ORequiredRelated(btmmrr *BaseImportTestsModelsM2ORequiredRelated) (int64, error) { + return c.Create(BaseImportTestsModelsM2ORequiredRelatedModel, btmmrr) +} + +// UpdateBaseImportTestsModelsM2ORequiredRelated updates an existing base_import.tests.models.m2o.required.related record. +func (c *Client) UpdateBaseImportTestsModelsM2ORequiredRelated(btmmrr *BaseImportTestsModelsM2ORequiredRelated) error { + return c.UpdateBaseImportTestsModelsM2ORequiredRelateds([]int64{btmmrr.Id.Get()}, btmmrr) +} + +// UpdateBaseImportTestsModelsM2ORequiredRelateds updates existing base_import.tests.models.m2o.required.related records. +// All records (represented by ids) will be updated by btmmrr values. +func (c *Client) UpdateBaseImportTestsModelsM2ORequiredRelateds(ids []int64, btmmrr *BaseImportTestsModelsM2ORequiredRelated) error { + return c.Update(BaseImportTestsModelsM2ORequiredRelatedModel, ids, btmmrr) +} + +// DeleteBaseImportTestsModelsM2ORequiredRelated deletes an existing base_import.tests.models.m2o.required.related record. +func (c *Client) DeleteBaseImportTestsModelsM2ORequiredRelated(id int64) error { + return c.DeleteBaseImportTestsModelsM2ORequiredRelateds([]int64{id}) +} + +// DeleteBaseImportTestsModelsM2ORequiredRelateds deletes existing base_import.tests.models.m2o.required.related records. +func (c *Client) DeleteBaseImportTestsModelsM2ORequiredRelateds(ids []int64) error { + return c.Delete(BaseImportTestsModelsM2ORequiredRelatedModel, ids) +} + +// GetBaseImportTestsModelsM2ORequiredRelated gets base_import.tests.models.m2o.required.related existing record. +func (c *Client) GetBaseImportTestsModelsM2ORequiredRelated(id int64) (*BaseImportTestsModelsM2ORequiredRelated, error) { + btmmrrs, err := c.GetBaseImportTestsModelsM2ORequiredRelateds([]int64{id}) + if err != nil { + return nil, err + } + if btmmrrs != nil && len(*btmmrrs) > 0 { + return &((*btmmrrs)[0]), nil + } + return nil, fmt.Errorf("id %v of base_import.tests.models.m2o.required.related not found", id) +} + +// GetBaseImportTestsModelsM2ORequiredRelateds gets base_import.tests.models.m2o.required.related existing records. +func (c *Client) GetBaseImportTestsModelsM2ORequiredRelateds(ids []int64) (*BaseImportTestsModelsM2ORequiredRelateds, error) { + btmmrrs := &BaseImportTestsModelsM2ORequiredRelateds{} + if err := c.Read(BaseImportTestsModelsM2ORequiredRelatedModel, ids, nil, btmmrrs); err != nil { + return nil, err + } + return btmmrrs, nil +} + +// FindBaseImportTestsModelsM2ORequiredRelated finds base_import.tests.models.m2o.required.related record by querying it with criteria. +func (c *Client) FindBaseImportTestsModelsM2ORequiredRelated(criteria *Criteria) (*BaseImportTestsModelsM2ORequiredRelated, error) { + btmmrrs := &BaseImportTestsModelsM2ORequiredRelateds{} + if err := c.SearchRead(BaseImportTestsModelsM2ORequiredRelatedModel, criteria, NewOptions().Limit(1), btmmrrs); err != nil { + return nil, err + } + if btmmrrs != nil && len(*btmmrrs) > 0 { + return &((*btmmrrs)[0]), nil + } + return nil, fmt.Errorf("no base_import.tests.models.m2o.required.related was found with criteria %v", criteria) +} + +// FindBaseImportTestsModelsM2ORequiredRelateds finds base_import.tests.models.m2o.required.related records by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseImportTestsModelsM2ORequiredRelateds(criteria *Criteria, options *Options) (*BaseImportTestsModelsM2ORequiredRelateds, error) { + btmmrrs := &BaseImportTestsModelsM2ORequiredRelateds{} + if err := c.SearchRead(BaseImportTestsModelsM2ORequiredRelatedModel, criteria, options, btmmrrs); err != nil { + return nil, err + } + return btmmrrs, nil +} + +// FindBaseImportTestsModelsM2ORequiredRelatedIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseImportTestsModelsM2ORequiredRelatedIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(BaseImportTestsModelsM2ORequiredRelatedModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindBaseImportTestsModelsM2ORequiredRelatedId finds record id by querying it with criteria. +func (c *Client) FindBaseImportTestsModelsM2ORequiredRelatedId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(BaseImportTestsModelsM2ORequiredRelatedModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no base_import.tests.models.m2o.required.related was found with criteria %v and options %v", criteria, options) +} diff --git a/base_import_tests_models_o2m.go b/base_import_tests_models_o2m.go new file mode 100644 index 00000000..2ceab556 --- /dev/null +++ b/base_import_tests_models_o2m.go @@ -0,0 +1,119 @@ +package odoo + +import ( + "fmt" +) + +// BaseImportTestsModelsO2M represents base_import.tests.models.o2m model. +type BaseImportTestsModelsO2M struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Value *Relation `xmlrpc:"value,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// BaseImportTestsModelsO2Ms represents array of base_import.tests.models.o2m model. +type BaseImportTestsModelsO2Ms []BaseImportTestsModelsO2M + +// BaseImportTestsModelsO2MModel is the odoo model name. +const BaseImportTestsModelsO2MModel = "base_import.tests.models.o2m" + +// Many2One convert BaseImportTestsModelsO2M to *Many2One. +func (btmo *BaseImportTestsModelsO2M) Many2One() *Many2One { + return NewMany2One(btmo.Id.Get(), "") +} + +// CreateBaseImportTestsModelsO2M creates a new base_import.tests.models.o2m model and returns its id. +func (c *Client) CreateBaseImportTestsModelsO2M(btmo *BaseImportTestsModelsO2M) (int64, error) { + return c.Create(BaseImportTestsModelsO2MModel, btmo) +} + +// UpdateBaseImportTestsModelsO2M updates an existing base_import.tests.models.o2m record. +func (c *Client) UpdateBaseImportTestsModelsO2M(btmo *BaseImportTestsModelsO2M) error { + return c.UpdateBaseImportTestsModelsO2Ms([]int64{btmo.Id.Get()}, btmo) +} + +// UpdateBaseImportTestsModelsO2Ms updates existing base_import.tests.models.o2m records. +// All records (represented by ids) will be updated by btmo values. +func (c *Client) UpdateBaseImportTestsModelsO2Ms(ids []int64, btmo *BaseImportTestsModelsO2M) error { + return c.Update(BaseImportTestsModelsO2MModel, ids, btmo) +} + +// DeleteBaseImportTestsModelsO2M deletes an existing base_import.tests.models.o2m record. +func (c *Client) DeleteBaseImportTestsModelsO2M(id int64) error { + return c.DeleteBaseImportTestsModelsO2Ms([]int64{id}) +} + +// DeleteBaseImportTestsModelsO2Ms deletes existing base_import.tests.models.o2m records. +func (c *Client) DeleteBaseImportTestsModelsO2Ms(ids []int64) error { + return c.Delete(BaseImportTestsModelsO2MModel, ids) +} + +// GetBaseImportTestsModelsO2M gets base_import.tests.models.o2m existing record. +func (c *Client) GetBaseImportTestsModelsO2M(id int64) (*BaseImportTestsModelsO2M, error) { + btmos, err := c.GetBaseImportTestsModelsO2Ms([]int64{id}) + if err != nil { + return nil, err + } + if btmos != nil && len(*btmos) > 0 { + return &((*btmos)[0]), nil + } + return nil, fmt.Errorf("id %v of base_import.tests.models.o2m not found", id) +} + +// GetBaseImportTestsModelsO2Ms gets base_import.tests.models.o2m existing records. +func (c *Client) GetBaseImportTestsModelsO2Ms(ids []int64) (*BaseImportTestsModelsO2Ms, error) { + btmos := &BaseImportTestsModelsO2Ms{} + if err := c.Read(BaseImportTestsModelsO2MModel, ids, nil, btmos); err != nil { + return nil, err + } + return btmos, nil +} + +// FindBaseImportTestsModelsO2M finds base_import.tests.models.o2m record by querying it with criteria. +func (c *Client) FindBaseImportTestsModelsO2M(criteria *Criteria) (*BaseImportTestsModelsO2M, error) { + btmos := &BaseImportTestsModelsO2Ms{} + if err := c.SearchRead(BaseImportTestsModelsO2MModel, criteria, NewOptions().Limit(1), btmos); err != nil { + return nil, err + } + if btmos != nil && len(*btmos) > 0 { + return &((*btmos)[0]), nil + } + return nil, fmt.Errorf("no base_import.tests.models.o2m was found with criteria %v", criteria) +} + +// FindBaseImportTestsModelsO2Ms finds base_import.tests.models.o2m records by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseImportTestsModelsO2Ms(criteria *Criteria, options *Options) (*BaseImportTestsModelsO2Ms, error) { + btmos := &BaseImportTestsModelsO2Ms{} + if err := c.SearchRead(BaseImportTestsModelsO2MModel, criteria, options, btmos); err != nil { + return nil, err + } + return btmos, nil +} + +// FindBaseImportTestsModelsO2MIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseImportTestsModelsO2MIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(BaseImportTestsModelsO2MModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindBaseImportTestsModelsO2MId finds record id by querying it with criteria. +func (c *Client) FindBaseImportTestsModelsO2MId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(BaseImportTestsModelsO2MModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no base_import.tests.models.o2m was found with criteria %v and options %v", criteria, options) +} diff --git a/base_import_tests_models_o2m_child.go b/base_import_tests_models_o2m_child.go new file mode 100644 index 00000000..2d67b075 --- /dev/null +++ b/base_import_tests_models_o2m_child.go @@ -0,0 +1,120 @@ +package odoo + +import ( + "fmt" +) + +// BaseImportTestsModelsO2MChild represents base_import.tests.models.o2m.child model. +type BaseImportTestsModelsO2MChild struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + ParentId *Many2One `xmlrpc:"parent_id,omitempty"` + Value *Int `xmlrpc:"value,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// BaseImportTestsModelsO2MChilds represents array of base_import.tests.models.o2m.child model. +type BaseImportTestsModelsO2MChilds []BaseImportTestsModelsO2MChild + +// BaseImportTestsModelsO2MChildModel is the odoo model name. +const BaseImportTestsModelsO2MChildModel = "base_import.tests.models.o2m.child" + +// Many2One convert BaseImportTestsModelsO2MChild to *Many2One. +func (btmoc *BaseImportTestsModelsO2MChild) Many2One() *Many2One { + return NewMany2One(btmoc.Id.Get(), "") +} + +// CreateBaseImportTestsModelsO2MChild creates a new base_import.tests.models.o2m.child model and returns its id. +func (c *Client) CreateBaseImportTestsModelsO2MChild(btmoc *BaseImportTestsModelsO2MChild) (int64, error) { + return c.Create(BaseImportTestsModelsO2MChildModel, btmoc) +} + +// UpdateBaseImportTestsModelsO2MChild updates an existing base_import.tests.models.o2m.child record. +func (c *Client) UpdateBaseImportTestsModelsO2MChild(btmoc *BaseImportTestsModelsO2MChild) error { + return c.UpdateBaseImportTestsModelsO2MChilds([]int64{btmoc.Id.Get()}, btmoc) +} + +// UpdateBaseImportTestsModelsO2MChilds updates existing base_import.tests.models.o2m.child records. +// All records (represented by ids) will be updated by btmoc values. +func (c *Client) UpdateBaseImportTestsModelsO2MChilds(ids []int64, btmoc *BaseImportTestsModelsO2MChild) error { + return c.Update(BaseImportTestsModelsO2MChildModel, ids, btmoc) +} + +// DeleteBaseImportTestsModelsO2MChild deletes an existing base_import.tests.models.o2m.child record. +func (c *Client) DeleteBaseImportTestsModelsO2MChild(id int64) error { + return c.DeleteBaseImportTestsModelsO2MChilds([]int64{id}) +} + +// DeleteBaseImportTestsModelsO2MChilds deletes existing base_import.tests.models.o2m.child records. +func (c *Client) DeleteBaseImportTestsModelsO2MChilds(ids []int64) error { + return c.Delete(BaseImportTestsModelsO2MChildModel, ids) +} + +// GetBaseImportTestsModelsO2MChild gets base_import.tests.models.o2m.child existing record. +func (c *Client) GetBaseImportTestsModelsO2MChild(id int64) (*BaseImportTestsModelsO2MChild, error) { + btmocs, err := c.GetBaseImportTestsModelsO2MChilds([]int64{id}) + if err != nil { + return nil, err + } + if btmocs != nil && len(*btmocs) > 0 { + return &((*btmocs)[0]), nil + } + return nil, fmt.Errorf("id %v of base_import.tests.models.o2m.child not found", id) +} + +// GetBaseImportTestsModelsO2MChilds gets base_import.tests.models.o2m.child existing records. +func (c *Client) GetBaseImportTestsModelsO2MChilds(ids []int64) (*BaseImportTestsModelsO2MChilds, error) { + btmocs := &BaseImportTestsModelsO2MChilds{} + if err := c.Read(BaseImportTestsModelsO2MChildModel, ids, nil, btmocs); err != nil { + return nil, err + } + return btmocs, nil +} + +// FindBaseImportTestsModelsO2MChild finds base_import.tests.models.o2m.child record by querying it with criteria. +func (c *Client) FindBaseImportTestsModelsO2MChild(criteria *Criteria) (*BaseImportTestsModelsO2MChild, error) { + btmocs := &BaseImportTestsModelsO2MChilds{} + if err := c.SearchRead(BaseImportTestsModelsO2MChildModel, criteria, NewOptions().Limit(1), btmocs); err != nil { + return nil, err + } + if btmocs != nil && len(*btmocs) > 0 { + return &((*btmocs)[0]), nil + } + return nil, fmt.Errorf("no base_import.tests.models.o2m.child was found with criteria %v", criteria) +} + +// FindBaseImportTestsModelsO2MChilds finds base_import.tests.models.o2m.child records by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseImportTestsModelsO2MChilds(criteria *Criteria, options *Options) (*BaseImportTestsModelsO2MChilds, error) { + btmocs := &BaseImportTestsModelsO2MChilds{} + if err := c.SearchRead(BaseImportTestsModelsO2MChildModel, criteria, options, btmocs); err != nil { + return nil, err + } + return btmocs, nil +} + +// FindBaseImportTestsModelsO2MChildIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseImportTestsModelsO2MChildIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(BaseImportTestsModelsO2MChildModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindBaseImportTestsModelsO2MChildId finds record id by querying it with criteria. +func (c *Client) FindBaseImportTestsModelsO2MChildId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(BaseImportTestsModelsO2MChildModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no base_import.tests.models.o2m.child was found with criteria %v and options %v", criteria, options) +} diff --git a/base_import_tests_models_preview.go b/base_import_tests_models_preview.go new file mode 100644 index 00000000..818813ea --- /dev/null +++ b/base_import_tests_models_preview.go @@ -0,0 +1,121 @@ +package odoo + +import ( + "fmt" +) + +// BaseImportTestsModelsPreview represents base_import.tests.models.preview model. +type BaseImportTestsModelsPreview struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` + Othervalue *Int `xmlrpc:"othervalue,omitempty"` + Somevalue *Int `xmlrpc:"somevalue,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// BaseImportTestsModelsPreviews represents array of base_import.tests.models.preview model. +type BaseImportTestsModelsPreviews []BaseImportTestsModelsPreview + +// BaseImportTestsModelsPreviewModel is the odoo model name. +const BaseImportTestsModelsPreviewModel = "base_import.tests.models.preview" + +// Many2One convert BaseImportTestsModelsPreview to *Many2One. +func (btmp *BaseImportTestsModelsPreview) Many2One() *Many2One { + return NewMany2One(btmp.Id.Get(), "") +} + +// CreateBaseImportTestsModelsPreview creates a new base_import.tests.models.preview model and returns its id. +func (c *Client) CreateBaseImportTestsModelsPreview(btmp *BaseImportTestsModelsPreview) (int64, error) { + return c.Create(BaseImportTestsModelsPreviewModel, btmp) +} + +// UpdateBaseImportTestsModelsPreview updates an existing base_import.tests.models.preview record. +func (c *Client) UpdateBaseImportTestsModelsPreview(btmp *BaseImportTestsModelsPreview) error { + return c.UpdateBaseImportTestsModelsPreviews([]int64{btmp.Id.Get()}, btmp) +} + +// UpdateBaseImportTestsModelsPreviews updates existing base_import.tests.models.preview records. +// All records (represented by ids) will be updated by btmp values. +func (c *Client) UpdateBaseImportTestsModelsPreviews(ids []int64, btmp *BaseImportTestsModelsPreview) error { + return c.Update(BaseImportTestsModelsPreviewModel, ids, btmp) +} + +// DeleteBaseImportTestsModelsPreview deletes an existing base_import.tests.models.preview record. +func (c *Client) DeleteBaseImportTestsModelsPreview(id int64) error { + return c.DeleteBaseImportTestsModelsPreviews([]int64{id}) +} + +// DeleteBaseImportTestsModelsPreviews deletes existing base_import.tests.models.preview records. +func (c *Client) DeleteBaseImportTestsModelsPreviews(ids []int64) error { + return c.Delete(BaseImportTestsModelsPreviewModel, ids) +} + +// GetBaseImportTestsModelsPreview gets base_import.tests.models.preview existing record. +func (c *Client) GetBaseImportTestsModelsPreview(id int64) (*BaseImportTestsModelsPreview, error) { + btmps, err := c.GetBaseImportTestsModelsPreviews([]int64{id}) + if err != nil { + return nil, err + } + if btmps != nil && len(*btmps) > 0 { + return &((*btmps)[0]), nil + } + return nil, fmt.Errorf("id %v of base_import.tests.models.preview not found", id) +} + +// GetBaseImportTestsModelsPreviews gets base_import.tests.models.preview existing records. +func (c *Client) GetBaseImportTestsModelsPreviews(ids []int64) (*BaseImportTestsModelsPreviews, error) { + btmps := &BaseImportTestsModelsPreviews{} + if err := c.Read(BaseImportTestsModelsPreviewModel, ids, nil, btmps); err != nil { + return nil, err + } + return btmps, nil +} + +// FindBaseImportTestsModelsPreview finds base_import.tests.models.preview record by querying it with criteria. +func (c *Client) FindBaseImportTestsModelsPreview(criteria *Criteria) (*BaseImportTestsModelsPreview, error) { + btmps := &BaseImportTestsModelsPreviews{} + if err := c.SearchRead(BaseImportTestsModelsPreviewModel, criteria, NewOptions().Limit(1), btmps); err != nil { + return nil, err + } + if btmps != nil && len(*btmps) > 0 { + return &((*btmps)[0]), nil + } + return nil, fmt.Errorf("no base_import.tests.models.preview was found with criteria %v", criteria) +} + +// FindBaseImportTestsModelsPreviews finds base_import.tests.models.preview records by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseImportTestsModelsPreviews(criteria *Criteria, options *Options) (*BaseImportTestsModelsPreviews, error) { + btmps := &BaseImportTestsModelsPreviews{} + if err := c.SearchRead(BaseImportTestsModelsPreviewModel, criteria, options, btmps); err != nil { + return nil, err + } + return btmps, nil +} + +// FindBaseImportTestsModelsPreviewIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseImportTestsModelsPreviewIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(BaseImportTestsModelsPreviewModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindBaseImportTestsModelsPreviewId finds record id by querying it with criteria. +func (c *Client) FindBaseImportTestsModelsPreviewId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(BaseImportTestsModelsPreviewModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no base_import.tests.models.preview was found with criteria %v and options %v", criteria, options) +} diff --git a/base_language_export.go b/base_language_export.go new file mode 100644 index 00000000..107c4d43 --- /dev/null +++ b/base_language_export.go @@ -0,0 +1,124 @@ +package odoo + +import ( + "fmt" +) + +// BaseLanguageExport represents base.language.export model. +type BaseLanguageExport struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Data *String `xmlrpc:"data,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Format *Selection `xmlrpc:"format,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Lang *Selection `xmlrpc:"lang,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) { + return c.Create(BaseLanguageExportModel, ble) +} + +// 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) +} + +// 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 + } + if bles != nil && len(*bles) > 0 { + return &((*bles)[0]), nil + } + return nil, fmt.Errorf("id %v of base.language.export not found", id) +} + +// 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 + } + if bles != nil && len(*bles) > 0 { + return &((*bles)[0]), nil + } + return nil, fmt.Errorf("no base.language.export was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(BaseLanguageExportModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no base.language.export was found with criteria %v and options %v", criteria, options) +} diff --git a/base_language_import.go b/base_language_import.go new file mode 100644 index 00000000..c0fcec0c --- /dev/null +++ b/base_language_import.go @@ -0,0 +1,123 @@ +package odoo + +import ( + "fmt" +) + +// BaseLanguageImport represents base.language.import model. +type BaseLanguageImport struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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) { + return c.Create(BaseLanguageImportModel, bli) +} + +// 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) +} + +// 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 + } + if blis != nil && len(*blis) > 0 { + return &((*blis)[0]), nil + } + return nil, fmt.Errorf("id %v of base.language.import not found", id) +} + +// 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 + } + if blis != nil && len(*blis) > 0 { + return &((*blis)[0]), nil + } + return nil, fmt.Errorf("no base.language.import was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(BaseLanguageImportModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no base.language.import was found with criteria %v and options %v", criteria, options) +} diff --git a/base_language_install.go b/base_language_install.go new file mode 100644 index 00000000..5eb6bd12 --- /dev/null +++ b/base_language_install.go @@ -0,0 +1,121 @@ +package odoo + +import ( + "fmt" +) + +// BaseLanguageInstall represents base.language.install model. +type BaseLanguageInstall struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` + Overwrite *Bool `xmlrpc:"overwrite,omitempty"` + State *Selection `xmlrpc:"state,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) { + return c.Create(BaseLanguageInstallModel, bli) +} + +// 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) +} + +// 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 + } + if blis != nil && len(*blis) > 0 { + return &((*blis)[0]), nil + } + return nil, fmt.Errorf("id %v of base.language.install not found", id) +} + +// 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 + } + if blis != nil && len(*blis) > 0 { + return &((*blis)[0]), nil + } + return nil, fmt.Errorf("no base.language.install was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(BaseLanguageInstallModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no base.language.install was found with criteria %v and options %v", criteria, options) +} diff --git a/base_module_uninstall.go b/base_module_uninstall.go new file mode 100644 index 00000000..9c50598f --- /dev/null +++ b/base_module_uninstall.go @@ -0,0 +1,122 @@ +package odoo + +import ( + "fmt" +) + +// BaseModuleUninstall represents base.module.uninstall model. +type BaseModuleUninstall struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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) { + return c.Create(BaseModuleUninstallModel, bmu) +} + +// 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) +} + +// 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 + } + if bmus != nil && len(*bmus) > 0 { + return &((*bmus)[0]), nil + } + return nil, fmt.Errorf("id %v of base.module.uninstall not found", id) +} + +// 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 + } + if bmus != nil && len(*bmus) > 0 { + return &((*bmus)[0]), nil + } + return nil, fmt.Errorf("no base.module.uninstall was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(BaseModuleUninstallModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no base.module.uninstall was found with criteria %v and options %v", criteria, options) +} diff --git a/base_module_update.go b/base_module_update.go new file mode 100644 index 00000000..397cdd6d --- /dev/null +++ b/base_module_update.go @@ -0,0 +1,121 @@ +package odoo + +import ( + "fmt" +) + +// BaseModuleUpdate represents base.module.update model. +type BaseModuleUpdate struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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) { + return c.Create(BaseModuleUpdateModel, bmu) +} + +// 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) +} + +// 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 + } + if bmus != nil && len(*bmus) > 0 { + return &((*bmus)[0]), nil + } + return nil, fmt.Errorf("id %v of base.module.update not found", id) +} + +// 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 + } + if bmus != nil && len(*bmus) > 0 { + return &((*bmus)[0]), nil + } + return nil, fmt.Errorf("no base.module.update was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(BaseModuleUpdateModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no base.module.update was found with criteria %v and options %v", criteria, options) +} diff --git a/base_module_upgrade.go b/base_module_upgrade.go new file mode 100644 index 00000000..c01aa97c --- /dev/null +++ b/base_module_upgrade.go @@ -0,0 +1,119 @@ +package odoo + +import ( + "fmt" +) + +// BaseModuleUpgrade represents base.module.upgrade model. +type BaseModuleUpgrade struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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) { + return c.Create(BaseModuleUpgradeModel, bmu) +} + +// 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) +} + +// 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 + } + if bmus != nil && len(*bmus) > 0 { + return &((*bmus)[0]), nil + } + return nil, fmt.Errorf("id %v of base.module.upgrade not found", id) +} + +// 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 + } + if bmus != nil && len(*bmus) > 0 { + return &((*bmus)[0]), nil + } + return nil, fmt.Errorf("no base.module.upgrade was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(BaseModuleUpgradeModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no base.module.upgrade was found with criteria %v and options %v", criteria, options) +} diff --git a/base_partner_merge_automatic_wizard.go b/base_partner_merge_automatic_wizard.go new file mode 100644 index 00000000..534d592c --- /dev/null +++ b/base_partner_merge_automatic_wizard.go @@ -0,0 +1,132 @@ +package odoo + +import ( + "fmt" +) + +// BasePartnerMergeAutomaticWizard represents base.partner.merge.automatic.wizard model. +type BasePartnerMergeAutomaticWizard struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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) { + return c.Create(BasePartnerMergeAutomaticWizardModel, bpmaw) +} + +// 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) +} + +// 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 + } + if bpmaws != nil && len(*bpmaws) > 0 { + return &((*bpmaws)[0]), nil + } + return nil, fmt.Errorf("id %v of base.partner.merge.automatic.wizard not found", id) +} + +// 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 + } + if bpmaws != nil && len(*bpmaws) > 0 { + return &((*bpmaws)[0]), nil + } + return nil, fmt.Errorf("no base.partner.merge.automatic.wizard was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(BasePartnerMergeAutomaticWizardModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no base.partner.merge.automatic.wizard was found with criteria %v and options %v", criteria, options) +} diff --git a/base_partner_merge_line.go b/base_partner_merge_line.go new file mode 100644 index 00000000..32a9aab7 --- /dev/null +++ b/base_partner_merge_line.go @@ -0,0 +1,121 @@ +package odoo + +import ( + "fmt" +) + +// BasePartnerMergeLine represents base.partner.merge.line model. +type BasePartnerMergeLine struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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) { + return c.Create(BasePartnerMergeLineModel, bpml) +} + +// 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) +} + +// 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 + } + if bpmls != nil && len(*bpmls) > 0 { + return &((*bpmls)[0]), nil + } + return nil, fmt.Errorf("id %v of base.partner.merge.line not found", id) +} + +// 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 + } + if bpmls != nil && len(*bpmls) > 0 { + return &((*bpmls)[0]), nil + } + return nil, fmt.Errorf("no base.partner.merge.line was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(BasePartnerMergeLineModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no base.partner.merge.line was found with criteria %v and options %v", criteria, options) +} diff --git a/base_update_translations.go b/base_update_translations.go new file mode 100644 index 00000000..b352c9d8 --- /dev/null +++ b/base_update_translations.go @@ -0,0 +1,119 @@ +package odoo + +import ( + "fmt" +) + +// BaseUpdateTranslations represents base.update.translations model. +type BaseUpdateTranslations struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// BaseUpdateTranslationss represents array of base.update.translations model. +type BaseUpdateTranslationss []BaseUpdateTranslations + +// BaseUpdateTranslationsModel is the odoo model name. +const BaseUpdateTranslationsModel = "base.update.translations" + +// Many2One convert BaseUpdateTranslations to *Many2One. +func (but *BaseUpdateTranslations) Many2One() *Many2One { + return NewMany2One(but.Id.Get(), "") +} + +// CreateBaseUpdateTranslations creates a new base.update.translations model and returns its id. +func (c *Client) CreateBaseUpdateTranslations(but *BaseUpdateTranslations) (int64, error) { + return c.Create(BaseUpdateTranslationsModel, but) +} + +// UpdateBaseUpdateTranslations updates an existing base.update.translations record. +func (c *Client) UpdateBaseUpdateTranslations(but *BaseUpdateTranslations) error { + return c.UpdateBaseUpdateTranslationss([]int64{but.Id.Get()}, but) +} + +// UpdateBaseUpdateTranslationss updates existing base.update.translations records. +// All records (represented by ids) will be updated by but values. +func (c *Client) UpdateBaseUpdateTranslationss(ids []int64, but *BaseUpdateTranslations) error { + return c.Update(BaseUpdateTranslationsModel, ids, but) +} + +// DeleteBaseUpdateTranslations deletes an existing base.update.translations record. +func (c *Client) DeleteBaseUpdateTranslations(id int64) error { + return c.DeleteBaseUpdateTranslationss([]int64{id}) +} + +// DeleteBaseUpdateTranslationss deletes existing base.update.translations records. +func (c *Client) DeleteBaseUpdateTranslationss(ids []int64) error { + return c.Delete(BaseUpdateTranslationsModel, ids) +} + +// GetBaseUpdateTranslations gets base.update.translations existing record. +func (c *Client) GetBaseUpdateTranslations(id int64) (*BaseUpdateTranslations, error) { + buts, err := c.GetBaseUpdateTranslationss([]int64{id}) + if err != nil { + return nil, err + } + if buts != nil && len(*buts) > 0 { + return &((*buts)[0]), nil + } + return nil, fmt.Errorf("id %v of base.update.translations not found", id) +} + +// GetBaseUpdateTranslationss gets base.update.translations existing records. +func (c *Client) GetBaseUpdateTranslationss(ids []int64) (*BaseUpdateTranslationss, error) { + buts := &BaseUpdateTranslationss{} + if err := c.Read(BaseUpdateTranslationsModel, ids, nil, buts); err != nil { + return nil, err + } + return buts, nil +} + +// FindBaseUpdateTranslations finds base.update.translations record by querying it with criteria. +func (c *Client) FindBaseUpdateTranslations(criteria *Criteria) (*BaseUpdateTranslations, error) { + buts := &BaseUpdateTranslationss{} + if err := c.SearchRead(BaseUpdateTranslationsModel, criteria, NewOptions().Limit(1), buts); err != nil { + return nil, err + } + if buts != nil && len(*buts) > 0 { + return &((*buts)[0]), nil + } + return nil, fmt.Errorf("no base.update.translations was found with criteria %v", criteria) +} + +// FindBaseUpdateTranslationss finds base.update.translations records by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseUpdateTranslationss(criteria *Criteria, options *Options) (*BaseUpdateTranslationss, error) { + buts := &BaseUpdateTranslationss{} + if err := c.SearchRead(BaseUpdateTranslationsModel, criteria, options, buts); err != nil { + return nil, err + } + return buts, nil +} + +// FindBaseUpdateTranslationsIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseUpdateTranslationsIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(BaseUpdateTranslationsModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindBaseUpdateTranslationsId finds record id by querying it with criteria. +func (c *Client) FindBaseUpdateTranslationsId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(BaseUpdateTranslationsModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no base.update.translations was found with criteria %v and options %v", criteria, options) +} diff --git a/board_board.go b/board_board.go new file mode 100644 index 00000000..181acded --- /dev/null +++ b/board_board.go @@ -0,0 +1,114 @@ +package odoo + +import ( + "fmt" +) + +// BoardBoard represents board.board model. +type BoardBoard struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` +} + +// BoardBoards represents array of board.board model. +type BoardBoards []BoardBoard + +// BoardBoardModel is the odoo model name. +const BoardBoardModel = "board.board" + +// Many2One convert BoardBoard to *Many2One. +func (bb *BoardBoard) Many2One() *Many2One { + return NewMany2One(bb.Id.Get(), "") +} + +// CreateBoardBoard creates a new board.board model and returns its id. +func (c *Client) CreateBoardBoard(bb *BoardBoard) (int64, error) { + return c.Create(BoardBoardModel, bb) +} + +// UpdateBoardBoard updates an existing board.board record. +func (c *Client) UpdateBoardBoard(bb *BoardBoard) error { + return c.UpdateBoardBoards([]int64{bb.Id.Get()}, bb) +} + +// UpdateBoardBoards updates existing board.board records. +// All records (represented by ids) will be updated by bb values. +func (c *Client) UpdateBoardBoards(ids []int64, bb *BoardBoard) error { + return c.Update(BoardBoardModel, ids, bb) +} + +// DeleteBoardBoard deletes an existing board.board record. +func (c *Client) DeleteBoardBoard(id int64) error { + return c.DeleteBoardBoards([]int64{id}) +} + +// DeleteBoardBoards deletes existing board.board records. +func (c *Client) DeleteBoardBoards(ids []int64) error { + return c.Delete(BoardBoardModel, ids) +} + +// GetBoardBoard gets board.board existing record. +func (c *Client) GetBoardBoard(id int64) (*BoardBoard, error) { + bbs, err := c.GetBoardBoards([]int64{id}) + if err != nil { + return nil, err + } + if bbs != nil && len(*bbs) > 0 { + return &((*bbs)[0]), nil + } + return nil, fmt.Errorf("id %v of board.board not found", id) +} + +// GetBoardBoards gets board.board existing records. +func (c *Client) GetBoardBoards(ids []int64) (*BoardBoards, error) { + bbs := &BoardBoards{} + if err := c.Read(BoardBoardModel, ids, nil, bbs); err != nil { + return nil, err + } + return bbs, nil +} + +// FindBoardBoard finds board.board record by querying it with criteria. +func (c *Client) FindBoardBoard(criteria *Criteria) (*BoardBoard, error) { + bbs := &BoardBoards{} + if err := c.SearchRead(BoardBoardModel, criteria, NewOptions().Limit(1), bbs); err != nil { + return nil, err + } + if bbs != nil && len(*bbs) > 0 { + return &((*bbs)[0]), nil + } + return nil, fmt.Errorf("no board.board was found with criteria %v", criteria) +} + +// FindBoardBoards finds board.board records by querying it +// and filtering it with criteria and options. +func (c *Client) FindBoardBoards(criteria *Criteria, options *Options) (*BoardBoards, error) { + bbs := &BoardBoards{} + if err := c.SearchRead(BoardBoardModel, criteria, options, bbs); err != nil { + return nil, err + } + return bbs, nil +} + +// FindBoardBoardIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindBoardBoardIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(BoardBoardModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindBoardBoardId finds record id by querying it with criteria. +func (c *Client) FindBoardBoardId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(BoardBoardModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no board.board was found with criteria %v and options %v", criteria, options) +} diff --git a/bus_bus.go b/bus_bus.go new file mode 100644 index 00000000..7a2db90b --- /dev/null +++ b/bus_bus.go @@ -0,0 +1,120 @@ +package odoo + +import ( + "fmt" +) + +// BusBus represents bus.bus model. +type BusBus struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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) { + return c.Create(BusBusModel, bb) +} + +// 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) +} + +// 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 + } + if bbs != nil && len(*bbs) > 0 { + return &((*bbs)[0]), nil + } + return nil, fmt.Errorf("id %v of bus.bus not found", id) +} + +// 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 + } + if bbs != nil && len(*bbs) > 0 { + return &((*bbs)[0]), nil + } + return nil, fmt.Errorf("no bus.bus was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(BusBusModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no bus.bus was found with criteria %v and options %v", criteria, options) +} diff --git a/bus_presence.go b/bus_presence.go new file mode 100644 index 00000000..cd0bccb9 --- /dev/null +++ b/bus_presence.go @@ -0,0 +1,118 @@ +package odoo + +import ( + "fmt" +) + +// BusPresence represents bus.presence model. +type BusPresence struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + DisplayName *String `xmlrpc:"display_name,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) { + return c.Create(BusPresenceModel, bp) +} + +// 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) +} + +// 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 + } + if bps != nil && len(*bps) > 0 { + return &((*bps)[0]), nil + } + return nil, fmt.Errorf("id %v of bus.presence not found", id) +} + +// 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 + } + if bps != nil && len(*bps) > 0 { + return &((*bps)[0]), nil + } + return nil, fmt.Errorf("no bus.presence was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(BusPresenceModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no bus.presence was found with criteria %v and options %v", criteria, options) +} diff --git a/calendar_alarm.go b/calendar_alarm.go new file mode 100644 index 00000000..505b0c01 --- /dev/null +++ b/calendar_alarm.go @@ -0,0 +1,123 @@ +package odoo + +import ( + "fmt" +) + +// CalendarAlarm represents calendar.alarm model. +type CalendarAlarm struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` + Name *String `xmlrpc:"name,omitempty"` + Type *Selection `xmlrpc:"type,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) { + return c.Create(CalendarAlarmModel, ca) +} + +// 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) +} + +// 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 + } + if cas != nil && len(*cas) > 0 { + return &((*cas)[0]), nil + } + return nil, fmt.Errorf("id %v of calendar.alarm not found", id) +} + +// 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 + } + if cas != nil && len(*cas) > 0 { + return &((*cas)[0]), nil + } + return nil, fmt.Errorf("no calendar.alarm was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(CalendarAlarmModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no calendar.alarm was found with criteria %v and options %v", criteria, options) +} diff --git a/calendar_alarm_manager.go b/calendar_alarm_manager.go new file mode 100644 index 00000000..3d0864b1 --- /dev/null +++ b/calendar_alarm_manager.go @@ -0,0 +1,114 @@ +package odoo + +import ( + "fmt" +) + +// CalendarAlarmManager represents calendar.alarm_manager model. +type CalendarAlarmManager struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` +} + +// CalendarAlarmManagers represents array of calendar.alarm_manager model. +type CalendarAlarmManagers []CalendarAlarmManager + +// CalendarAlarmManagerModel is the odoo model name. +const CalendarAlarmManagerModel = "calendar.alarm_manager" + +// Many2One convert CalendarAlarmManager to *Many2One. +func (ca *CalendarAlarmManager) Many2One() *Many2One { + return NewMany2One(ca.Id.Get(), "") +} + +// CreateCalendarAlarmManager creates a new calendar.alarm_manager model and returns its id. +func (c *Client) CreateCalendarAlarmManager(ca *CalendarAlarmManager) (int64, error) { + return c.Create(CalendarAlarmManagerModel, ca) +} + +// UpdateCalendarAlarmManager updates an existing calendar.alarm_manager record. +func (c *Client) UpdateCalendarAlarmManager(ca *CalendarAlarmManager) error { + return c.UpdateCalendarAlarmManagers([]int64{ca.Id.Get()}, ca) +} + +// UpdateCalendarAlarmManagers updates existing calendar.alarm_manager records. +// All records (represented by ids) will be updated by ca values. +func (c *Client) UpdateCalendarAlarmManagers(ids []int64, ca *CalendarAlarmManager) error { + return c.Update(CalendarAlarmManagerModel, ids, ca) +} + +// DeleteCalendarAlarmManager deletes an existing calendar.alarm_manager record. +func (c *Client) DeleteCalendarAlarmManager(id int64) error { + return c.DeleteCalendarAlarmManagers([]int64{id}) +} + +// DeleteCalendarAlarmManagers deletes existing calendar.alarm_manager records. +func (c *Client) DeleteCalendarAlarmManagers(ids []int64) error { + return c.Delete(CalendarAlarmManagerModel, ids) +} + +// GetCalendarAlarmManager gets calendar.alarm_manager existing record. +func (c *Client) GetCalendarAlarmManager(id int64) (*CalendarAlarmManager, error) { + cas, err := c.GetCalendarAlarmManagers([]int64{id}) + if err != nil { + return nil, err + } + if cas != nil && len(*cas) > 0 { + return &((*cas)[0]), nil + } + return nil, fmt.Errorf("id %v of calendar.alarm_manager not found", id) +} + +// GetCalendarAlarmManagers gets calendar.alarm_manager existing records. +func (c *Client) GetCalendarAlarmManagers(ids []int64) (*CalendarAlarmManagers, error) { + cas := &CalendarAlarmManagers{} + if err := c.Read(CalendarAlarmManagerModel, ids, nil, cas); err != nil { + return nil, err + } + return cas, nil +} + +// FindCalendarAlarmManager finds calendar.alarm_manager record by querying it with criteria. +func (c *Client) FindCalendarAlarmManager(criteria *Criteria) (*CalendarAlarmManager, error) { + cas := &CalendarAlarmManagers{} + if err := c.SearchRead(CalendarAlarmManagerModel, criteria, NewOptions().Limit(1), cas); err != nil { + return nil, err + } + if cas != nil && len(*cas) > 0 { + return &((*cas)[0]), nil + } + return nil, fmt.Errorf("no calendar.alarm_manager was found with criteria %v", criteria) +} + +// FindCalendarAlarmManagers finds calendar.alarm_manager records by querying it +// and filtering it with criteria and options. +func (c *Client) FindCalendarAlarmManagers(criteria *Criteria, options *Options) (*CalendarAlarmManagers, error) { + cas := &CalendarAlarmManagers{} + if err := c.SearchRead(CalendarAlarmManagerModel, criteria, options, cas); err != nil { + return nil, err + } + return cas, nil +} + +// FindCalendarAlarmManagerIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindCalendarAlarmManagerIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(CalendarAlarmManagerModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindCalendarAlarmManagerId finds record id by querying it with criteria. +func (c *Client) FindCalendarAlarmManagerId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(CalendarAlarmManagerModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no calendar.alarm_manager was found with criteria %v and options %v", criteria, options) +} diff --git a/calendar_attendee.go b/calendar_attendee.go new file mode 100644 index 00000000..97994bd7 --- /dev/null +++ b/calendar_attendee.go @@ -0,0 +1,125 @@ +package odoo + +import ( + "fmt" +) + +// CalendarAttendee represents calendar.attendee model. +type CalendarAttendee struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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"` + PartnerId *Many2One `xmlrpc:"partner_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) { + return c.Create(CalendarAttendeeModel, ca) +} + +// 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) +} + +// 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 + } + if cas != nil && len(*cas) > 0 { + return &((*cas)[0]), nil + } + return nil, fmt.Errorf("id %v of calendar.attendee not found", id) +} + +// 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 + } + if cas != nil && len(*cas) > 0 { + return &((*cas)[0]), nil + } + return nil, fmt.Errorf("no calendar.attendee was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(CalendarAttendeeModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no calendar.attendee was found with criteria %v and options %v", criteria, options) +} diff --git a/calendar_contacts.go b/calendar_contacts.go new file mode 100644 index 00000000..77c58dfe --- /dev/null +++ b/calendar_contacts.go @@ -0,0 +1,121 @@ +package odoo + +import ( + "fmt" +) + +// CalendarContacts represents calendar.contacts model. +type CalendarContacts struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// CalendarContactss represents array of calendar.contacts model. +type CalendarContactss []CalendarContacts + +// CalendarContactsModel is the odoo model name. +const CalendarContactsModel = "calendar.contacts" + +// Many2One convert CalendarContacts to *Many2One. +func (cc *CalendarContacts) Many2One() *Many2One { + return NewMany2One(cc.Id.Get(), "") +} + +// CreateCalendarContacts creates a new calendar.contacts model and returns its id. +func (c *Client) CreateCalendarContacts(cc *CalendarContacts) (int64, error) { + return c.Create(CalendarContactsModel, cc) +} + +// UpdateCalendarContacts updates an existing calendar.contacts record. +func (c *Client) UpdateCalendarContacts(cc *CalendarContacts) error { + return c.UpdateCalendarContactss([]int64{cc.Id.Get()}, cc) +} + +// UpdateCalendarContactss updates existing calendar.contacts records. +// All records (represented by ids) will be updated by cc values. +func (c *Client) UpdateCalendarContactss(ids []int64, cc *CalendarContacts) error { + return c.Update(CalendarContactsModel, ids, cc) +} + +// DeleteCalendarContacts deletes an existing calendar.contacts record. +func (c *Client) DeleteCalendarContacts(id int64) error { + return c.DeleteCalendarContactss([]int64{id}) +} + +// DeleteCalendarContactss deletes existing calendar.contacts records. +func (c *Client) DeleteCalendarContactss(ids []int64) error { + return c.Delete(CalendarContactsModel, ids) +} + +// GetCalendarContacts gets calendar.contacts existing record. +func (c *Client) GetCalendarContacts(id int64) (*CalendarContacts, error) { + ccs, err := c.GetCalendarContactss([]int64{id}) + if err != nil { + return nil, err + } + if ccs != nil && len(*ccs) > 0 { + return &((*ccs)[0]), nil + } + return nil, fmt.Errorf("id %v of calendar.contacts not found", id) +} + +// GetCalendarContactss gets calendar.contacts existing records. +func (c *Client) GetCalendarContactss(ids []int64) (*CalendarContactss, error) { + ccs := &CalendarContactss{} + if err := c.Read(CalendarContactsModel, ids, nil, ccs); err != nil { + return nil, err + } + return ccs, nil +} + +// FindCalendarContacts finds calendar.contacts record by querying it with criteria. +func (c *Client) FindCalendarContacts(criteria *Criteria) (*CalendarContacts, error) { + ccs := &CalendarContactss{} + if err := c.SearchRead(CalendarContactsModel, criteria, NewOptions().Limit(1), ccs); err != nil { + return nil, err + } + if ccs != nil && len(*ccs) > 0 { + return &((*ccs)[0]), nil + } + return nil, fmt.Errorf("no calendar.contacts was found with criteria %v", criteria) +} + +// FindCalendarContactss finds calendar.contacts records by querying it +// and filtering it with criteria and options. +func (c *Client) FindCalendarContactss(criteria *Criteria, options *Options) (*CalendarContactss, error) { + ccs := &CalendarContactss{} + if err := c.SearchRead(CalendarContactsModel, criteria, options, ccs); err != nil { + return nil, err + } + return ccs, nil +} + +// FindCalendarContactsIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindCalendarContactsIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(CalendarContactsModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindCalendarContactsId finds record id by querying it with criteria. +func (c *Client) FindCalendarContactsId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(CalendarContactsModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no calendar.contacts was found with criteria %v and options %v", criteria, options) +} diff --git a/calendar_event.go b/calendar_event.go new file mode 100644 index 00000000..0b0eb540 --- /dev/null +++ b/calendar_event.go @@ -0,0 +1,180 @@ +package odoo + +import ( + "fmt" +) + +// CalendarEvent represents calendar.event model. +type CalendarEvent struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + Active *Bool `xmlrpc:"active,omitempty"` + ActivityIds *Relation `xmlrpc:"activity_ids,omitempty"` + AlarmIds *Relation `xmlrpc:"alarm_ids,omitempty"` + Allday *Bool `xmlrpc:"allday,omitempty"` + AttendeeIds *Relation `xmlrpc:"attendee_ids,omitempty"` + AttendeeStatus *Selection `xmlrpc:"attendee_status,omitempty"` + Byday *Selection `xmlrpc:"byday,omitempty"` + CategIds *Relation `xmlrpc:"categ_ids,omitempty"` + Count *Int `xmlrpc:"count,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Day *Int `xmlrpc:"day,omitempty"` + Description *String `xmlrpc:"description,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + DisplayStart *String `xmlrpc:"display_start,omitempty"` + DisplayTime *String `xmlrpc:"display_time,omitempty"` + Duration *Float `xmlrpc:"duration,omitempty"` + EndType *Selection `xmlrpc:"end_type,omitempty"` + FinalDate *Time `xmlrpc:"final_date,omitempty"` + Fr *Bool `xmlrpc:"fr,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Interval *Int `xmlrpc:"interval,omitempty"` + IsAttendee *Bool `xmlrpc:"is_attendee,omitempty"` + IsHighlighted *Bool `xmlrpc:"is_highlighted,omitempty"` + Location *String `xmlrpc:"location,omitempty"` + MessageChannelIds *Relation `xmlrpc:"message_channel_ids,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageLastPost *Time `xmlrpc:"message_last_post,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MessageUnread *Bool `xmlrpc:"message_unread,omitempty"` + MessageUnreadCounter *Int `xmlrpc:"message_unread_counter,omitempty"` + Mo *Bool `xmlrpc:"mo,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"` + Recurrency *Bool `xmlrpc:"recurrency,omitempty"` + RecurrentId *Int `xmlrpc:"recurrent_id,omitempty"` + RecurrentIdDate *Time `xmlrpc:"recurrent_id_date,omitempty"` + ResId *Int `xmlrpc:"res_id,omitempty"` + ResModel *String `xmlrpc:"res_model,omitempty"` + ResModelId *Many2One `xmlrpc:"res_model_id,omitempty"` + Rrule *String `xmlrpc:"rrule,omitempty"` + RruleType *Selection `xmlrpc:"rrule_type,omitempty"` + Sa *Bool `xmlrpc:"sa,omitempty"` + ShowAs *Selection `xmlrpc:"show_as,omitempty"` + Start *Time `xmlrpc:"start,omitempty"` + StartDate *Time `xmlrpc:"start_date,omitempty"` + StartDatetime *Time `xmlrpc:"start_datetime,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + Stop *Time `xmlrpc:"stop,omitempty"` + StopDate *Time `xmlrpc:"stop_date,omitempty"` + StopDatetime *Time `xmlrpc:"stop_datetime,omitempty"` + Su *Bool `xmlrpc:"su,omitempty"` + Th *Bool `xmlrpc:"th,omitempty"` + Tu *Bool `xmlrpc:"tu,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + We *Bool `xmlrpc:"we,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + WeekList *Selection `xmlrpc:"week_list,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) { + return c.Create(CalendarEventModel, ce) +} + +// 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) +} + +// 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 + } + if ces != nil && len(*ces) > 0 { + return &((*ces)[0]), nil + } + return nil, fmt.Errorf("id %v of calendar.event not found", id) +} + +// 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 + } + if ces != nil && len(*ces) > 0 { + return &((*ces)[0]), nil + } + return nil, fmt.Errorf("no calendar.event was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(CalendarEventModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no calendar.event was found with criteria %v and options %v", criteria, options) +} diff --git a/calendar_event_type.go b/calendar_event_type.go new file mode 100644 index 00000000..ca6a8d62 --- /dev/null +++ b/calendar_event_type.go @@ -0,0 +1,119 @@ +package odoo + +import ( + "fmt" +) + +// CalendarEventType represents calendar.event.type model. +type CalendarEventType struct { + LastUpdate *Time `xmlrpc:"__last_update,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) { + return c.Create(CalendarEventTypeModel, cet) +} + +// 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) +} + +// 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 + } + if cets != nil && len(*cets) > 0 { + return &((*cets)[0]), nil + } + return nil, fmt.Errorf("id %v of calendar.event.type not found", id) +} + +// 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 + } + if cets != nil && len(*cets) > 0 { + return &((*cets)[0]), nil + } + return nil, fmt.Errorf("no calendar.event.type was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(CalendarEventTypeModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no calendar.event.type was found with criteria %v and options %v", criteria, options) +} diff --git a/cash_box_in.go b/cash_box_in.go new file mode 100644 index 00000000..ba00c893 --- /dev/null +++ b/cash_box_in.go @@ -0,0 +1,121 @@ +package odoo + +import ( + "fmt" +) + +// CashBoxIn represents cash.box.in model. +type CashBoxIn struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + Amount *Float `xmlrpc:"amount,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"` + Ref *String `xmlrpc:"ref,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// CashBoxIns represents array of cash.box.in model. +type CashBoxIns []CashBoxIn + +// CashBoxInModel is the odoo model name. +const CashBoxInModel = "cash.box.in" + +// Many2One convert CashBoxIn to *Many2One. +func (cbi *CashBoxIn) Many2One() *Many2One { + return NewMany2One(cbi.Id.Get(), "") +} + +// CreateCashBoxIn creates a new cash.box.in model and returns its id. +func (c *Client) CreateCashBoxIn(cbi *CashBoxIn) (int64, error) { + return c.Create(CashBoxInModel, cbi) +} + +// UpdateCashBoxIn updates an existing cash.box.in record. +func (c *Client) UpdateCashBoxIn(cbi *CashBoxIn) error { + return c.UpdateCashBoxIns([]int64{cbi.Id.Get()}, cbi) +} + +// UpdateCashBoxIns updates existing cash.box.in records. +// All records (represented by ids) will be updated by cbi values. +func (c *Client) UpdateCashBoxIns(ids []int64, cbi *CashBoxIn) error { + return c.Update(CashBoxInModel, ids, cbi) +} + +// DeleteCashBoxIn deletes an existing cash.box.in record. +func (c *Client) DeleteCashBoxIn(id int64) error { + return c.DeleteCashBoxIns([]int64{id}) +} + +// DeleteCashBoxIns deletes existing cash.box.in records. +func (c *Client) DeleteCashBoxIns(ids []int64) error { + return c.Delete(CashBoxInModel, ids) +} + +// GetCashBoxIn gets cash.box.in existing record. +func (c *Client) GetCashBoxIn(id int64) (*CashBoxIn, error) { + cbis, err := c.GetCashBoxIns([]int64{id}) + if err != nil { + return nil, err + } + if cbis != nil && len(*cbis) > 0 { + return &((*cbis)[0]), nil + } + return nil, fmt.Errorf("id %v of cash.box.in not found", id) +} + +// GetCashBoxIns gets cash.box.in existing records. +func (c *Client) GetCashBoxIns(ids []int64) (*CashBoxIns, error) { + cbis := &CashBoxIns{} + if err := c.Read(CashBoxInModel, ids, nil, cbis); err != nil { + return nil, err + } + return cbis, nil +} + +// FindCashBoxIn finds cash.box.in record by querying it with criteria. +func (c *Client) FindCashBoxIn(criteria *Criteria) (*CashBoxIn, error) { + cbis := &CashBoxIns{} + if err := c.SearchRead(CashBoxInModel, criteria, NewOptions().Limit(1), cbis); err != nil { + return nil, err + } + if cbis != nil && len(*cbis) > 0 { + return &((*cbis)[0]), nil + } + return nil, fmt.Errorf("no cash.box.in was found with criteria %v", criteria) +} + +// FindCashBoxIns finds cash.box.in records by querying it +// and filtering it with criteria and options. +func (c *Client) FindCashBoxIns(criteria *Criteria, options *Options) (*CashBoxIns, error) { + cbis := &CashBoxIns{} + if err := c.SearchRead(CashBoxInModel, criteria, options, cbis); err != nil { + return nil, err + } + return cbis, nil +} + +// FindCashBoxInIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindCashBoxInIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(CashBoxInModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindCashBoxInId finds record id by querying it with criteria. +func (c *Client) FindCashBoxInId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(CashBoxInModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no cash.box.in was found with criteria %v and options %v", criteria, options) +} diff --git a/cash_box_out.go b/cash_box_out.go new file mode 100644 index 00000000..ad08e3bd --- /dev/null +++ b/cash_box_out.go @@ -0,0 +1,120 @@ +package odoo + +import ( + "fmt" +) + +// CashBoxOut represents cash.box.out model. +type CashBoxOut struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + Amount *Float `xmlrpc:"amount,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"` +} + +// CashBoxOuts represents array of cash.box.out model. +type CashBoxOuts []CashBoxOut + +// CashBoxOutModel is the odoo model name. +const CashBoxOutModel = "cash.box.out" + +// Many2One convert CashBoxOut to *Many2One. +func (cbo *CashBoxOut) Many2One() *Many2One { + return NewMany2One(cbo.Id.Get(), "") +} + +// CreateCashBoxOut creates a new cash.box.out model and returns its id. +func (c *Client) CreateCashBoxOut(cbo *CashBoxOut) (int64, error) { + return c.Create(CashBoxOutModel, cbo) +} + +// UpdateCashBoxOut updates an existing cash.box.out record. +func (c *Client) UpdateCashBoxOut(cbo *CashBoxOut) error { + return c.UpdateCashBoxOuts([]int64{cbo.Id.Get()}, cbo) +} + +// UpdateCashBoxOuts updates existing cash.box.out records. +// All records (represented by ids) will be updated by cbo values. +func (c *Client) UpdateCashBoxOuts(ids []int64, cbo *CashBoxOut) error { + return c.Update(CashBoxOutModel, ids, cbo) +} + +// DeleteCashBoxOut deletes an existing cash.box.out record. +func (c *Client) DeleteCashBoxOut(id int64) error { + return c.DeleteCashBoxOuts([]int64{id}) +} + +// DeleteCashBoxOuts deletes existing cash.box.out records. +func (c *Client) DeleteCashBoxOuts(ids []int64) error { + return c.Delete(CashBoxOutModel, ids) +} + +// GetCashBoxOut gets cash.box.out existing record. +func (c *Client) GetCashBoxOut(id int64) (*CashBoxOut, error) { + cbos, err := c.GetCashBoxOuts([]int64{id}) + if err != nil { + return nil, err + } + if cbos != nil && len(*cbos) > 0 { + return &((*cbos)[0]), nil + } + return nil, fmt.Errorf("id %v of cash.box.out not found", id) +} + +// GetCashBoxOuts gets cash.box.out existing records. +func (c *Client) GetCashBoxOuts(ids []int64) (*CashBoxOuts, error) { + cbos := &CashBoxOuts{} + if err := c.Read(CashBoxOutModel, ids, nil, cbos); err != nil { + return nil, err + } + return cbos, nil +} + +// FindCashBoxOut finds cash.box.out record by querying it with criteria. +func (c *Client) FindCashBoxOut(criteria *Criteria) (*CashBoxOut, error) { + cbos := &CashBoxOuts{} + if err := c.SearchRead(CashBoxOutModel, criteria, NewOptions().Limit(1), cbos); err != nil { + return nil, err + } + if cbos != nil && len(*cbos) > 0 { + return &((*cbos)[0]), nil + } + return nil, fmt.Errorf("no cash.box.out was found with criteria %v", criteria) +} + +// FindCashBoxOuts finds cash.box.out records by querying it +// and filtering it with criteria and options. +func (c *Client) FindCashBoxOuts(criteria *Criteria, options *Options) (*CashBoxOuts, error) { + cbos := &CashBoxOuts{} + if err := c.SearchRead(CashBoxOutModel, criteria, options, cbos); err != nil { + return nil, err + } + return cbos, nil +} + +// FindCashBoxOutIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindCashBoxOutIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(CashBoxOutModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindCashBoxOutId finds record id by querying it with criteria. +func (c *Client) FindCashBoxOutId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(CashBoxOutModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no cash.box.out was found with criteria %v and options %v", criteria, options) +} diff --git a/change_password_user.go b/change_password_user.go new file mode 100644 index 00000000..c828560e --- /dev/null +++ b/change_password_user.go @@ -0,0 +1,122 @@ +package odoo + +import ( + "fmt" +) + +// ChangePasswordUser represents change.password.user model. +type ChangePasswordUser struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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) { + return c.Create(ChangePasswordUserModel, cpu) +} + +// 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) +} + +// 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 + } + if cpus != nil && len(*cpus) > 0 { + return &((*cpus)[0]), nil + } + return nil, fmt.Errorf("id %v of change.password.user not found", id) +} + +// 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 + } + if cpus != nil && len(*cpus) > 0 { + return &((*cpus)[0]), nil + } + return nil, fmt.Errorf("no change.password.user was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(ChangePasswordUserModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no change.password.user was found with criteria %v and options %v", criteria, options) +} diff --git a/change_password_wizard.go b/change_password_wizard.go new file mode 100644 index 00000000..ff778d8d --- /dev/null +++ b/change_password_wizard.go @@ -0,0 +1,119 @@ +package odoo + +import ( + "fmt" +) + +// ChangePasswordWizard represents change.password.wizard model. +type ChangePasswordWizard struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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) { + return c.Create(ChangePasswordWizardModel, cpw) +} + +// 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) +} + +// 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 + } + if cpws != nil && len(*cpws) > 0 { + return &((*cpws)[0]), nil + } + return nil, fmt.Errorf("id %v of change.password.wizard not found", id) +} + +// 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 + } + if cpws != nil && len(*cpws) > 0 { + return &((*cpws)[0]), nil + } + return nil, fmt.Errorf("no change.password.wizard was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(ChangePasswordWizardModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no change.password.wizard was found with criteria %v and options %v", criteria, options) +} diff --git a/crm_activity_report.go b/crm_activity_report.go new file mode 100644 index 00000000..dd3eb5ff --- /dev/null +++ b/crm_activity_report.go @@ -0,0 +1,129 @@ +package odoo + +import ( + "fmt" +) + +// CrmActivityReport represents crm.activity.report model. +type CrmActivityReport struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + Active *Bool `xmlrpc:"active,omitempty"` + AuthorId *Many2One `xmlrpc:"author_id,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CountryId *Many2One `xmlrpc:"country_id,omitempty"` + Date *Time `xmlrpc:"date,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LeadId *Many2One `xmlrpc:"lead_id,omitempty"` + LeadType *String `xmlrpc:"lead_type,omitempty"` + MailActivityTypeId *Many2One `xmlrpc:"mail_activity_type_id,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + Probability *Float `xmlrpc:"probability,omitempty"` + StageId *Many2One `xmlrpc:"stage_id,omitempty"` + Subject *String `xmlrpc:"subject,omitempty"` + SubtypeId *Many2One `xmlrpc:"subtype_id,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) { + return c.Create(CrmActivityReportModel, car) +} + +// 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) +} + +// 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 + } + if cars != nil && len(*cars) > 0 { + return &((*cars)[0]), nil + } + return nil, fmt.Errorf("id %v of crm.activity.report not found", id) +} + +// 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 + } + if cars != nil && len(*cars) > 0 { + return &((*cars)[0]), nil + } + return nil, fmt.Errorf("no crm.activity.report was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(CrmActivityReportModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no crm.activity.report was found with criteria %v and options %v", criteria, options) +} diff --git a/crm_lead.go b/crm_lead.go index 75744ad9..11bc9bbd 100644 --- a/crm_lead.go +++ b/crm_lead.go @@ -6,85 +6,85 @@ import ( // CrmLead represents crm.lead model. type CrmLead struct { - LastUpdate *Time `xmlrpc:"__last_update,omptempty"` - Active *Bool `xmlrpc:"active,omptempty"` - ActivityDateDeadline *Time `xmlrpc:"activity_date_deadline,omptempty"` - ActivityIds *Relation `xmlrpc:"activity_ids,omptempty"` - ActivityState *Selection `xmlrpc:"activity_state,omptempty"` - ActivitySummary *String `xmlrpc:"activity_summary,omptempty"` - ActivityTypeId *Many2One `xmlrpc:"activity_type_id,omptempty"` - ActivityUserId *Many2One `xmlrpc:"activity_user_id,omptempty"` - CampaignId *Many2One `xmlrpc:"campaign_id,omptempty"` - City *String `xmlrpc:"city,omptempty"` - Color *Int `xmlrpc:"color,omptempty"` - CompanyCurrency *Many2One `xmlrpc:"company_currency,omptempty"` - CompanyId *Many2One `xmlrpc:"company_id,omptempty"` - ContactName *String `xmlrpc:"contact_name,omptempty"` - CountryId *Many2One `xmlrpc:"country_id,omptempty"` - CreateDate *Time `xmlrpc:"create_date,omptempty"` - CreateUid *Many2One `xmlrpc:"create_uid,omptempty"` - DateActionLast *Time `xmlrpc:"date_action_last,omptempty"` - DateClosed *Time `xmlrpc:"date_closed,omptempty"` - DateConversion *Time `xmlrpc:"date_conversion,omptempty"` - DateDeadline *Time `xmlrpc:"date_deadline,omptempty"` - DateLastStageUpdate *Time `xmlrpc:"date_last_stage_update,omptempty"` - DateOpen *Time `xmlrpc:"date_open,omptempty"` - DayClose *Float `xmlrpc:"day_close,omptempty"` - DayOpen *Float `xmlrpc:"day_open,omptempty"` - Description *String `xmlrpc:"description,omptempty"` - DisplayName *String `xmlrpc:"display_name,omptempty"` - EmailCc *String `xmlrpc:"email_cc,omptempty"` - EmailFrom *String `xmlrpc:"email_from,omptempty"` - Function *String `xmlrpc:"function,omptempty"` - Id *Int `xmlrpc:"id,omptempty"` - KanbanState *Selection `xmlrpc:"kanban_state,omptempty"` - LostReason *Many2One `xmlrpc:"lost_reason,omptempty"` - MachineLeadName *String `xmlrpc:"machine_lead_name,omptempty"` - MediumId *Many2One `xmlrpc:"medium_id,omptempty"` - MeetingCount *Int `xmlrpc:"meeting_count,omptempty"` - MessageBounce *Int `xmlrpc:"message_bounce,omptempty"` - MessageChannelIds *Relation `xmlrpc:"message_channel_ids,omptempty"` - MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omptempty"` - MessageIds *Relation `xmlrpc:"message_ids,omptempty"` - MessageIsFollower *Bool `xmlrpc:"message_is_follower,omptempty"` - MessageLastPost *Time `xmlrpc:"message_last_post,omptempty"` - MessageNeedaction *Bool `xmlrpc:"message_needaction,omptempty"` - MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omptempty"` - MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omptempty"` - MessageUnread *Bool `xmlrpc:"message_unread,omptempty"` - MessageUnreadCounter *Int `xmlrpc:"message_unread_counter,omptempty"` - Mobile *String `xmlrpc:"mobile,omptempty"` - Name *String `xmlrpc:"name,omptempty"` - OptOut *Bool `xmlrpc:"opt_out,omptempty"` - OrderIds *Relation `xmlrpc:"order_ids,omptempty"` - PartnerAddressEmail *String `xmlrpc:"partner_address_email,omptempty"` - PartnerAddressName *String `xmlrpc:"partner_address_name,omptempty"` - PartnerId *Many2One `xmlrpc:"partner_id,omptempty"` - PartnerName *String `xmlrpc:"partner_name,omptempty"` - Phone *String `xmlrpc:"phone,omptempty"` - PlannedRevenue *Float `xmlrpc:"planned_revenue,omptempty"` - Priority *Selection `xmlrpc:"priority,omptempty"` - Probability *Float `xmlrpc:"probability,omptempty"` - Referred *String `xmlrpc:"referred,omptempty"` - SaleAmountTotal *Float `xmlrpc:"sale_amount_total,omptempty"` - SaleNumber *Int `xmlrpc:"sale_number,omptempty"` - SourceId *Many2One `xmlrpc:"source_id,omptempty"` - StageId *Many2One `xmlrpc:"stage_id,omptempty"` - StateId *Many2One `xmlrpc:"state_id,omptempty"` - Street *String `xmlrpc:"street,omptempty"` - Street2 *String `xmlrpc:"street2,omptempty"` - TagIds *Relation `xmlrpc:"tag_ids,omptempty"` - TeamId *Many2One `xmlrpc:"team_id,omptempty"` - Title *Many2One `xmlrpc:"title,omptempty"` - Type *Selection `xmlrpc:"type,omptempty"` - UserEmail *String `xmlrpc:"user_email,omptempty"` - UserId *Many2One `xmlrpc:"user_id,omptempty"` - UserLogin *String `xmlrpc:"user_login,omptempty"` - Website *String `xmlrpc:"website,omptempty"` - WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omptempty"` - WriteDate *Time `xmlrpc:"write_date,omptempty"` - WriteUid *Many2One `xmlrpc:"write_uid,omptempty"` - Zip *String `xmlrpc:"zip,omptempty"` + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + Active *Bool `xmlrpc:"active,omitempty"` + ActivityDateDeadline *Time `xmlrpc:"activity_date_deadline,omitempty"` + ActivityIds *Relation `xmlrpc:"activity_ids,omitempty"` + ActivityState *Selection `xmlrpc:"activity_state,omitempty"` + ActivitySummary *String `xmlrpc:"activity_summary,omitempty"` + ActivityTypeId *Many2One `xmlrpc:"activity_type_id,omitempty"` + ActivityUserId *Many2One `xmlrpc:"activity_user_id,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"` + DateActionLast *Time `xmlrpc:"date_action_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"` + EmailCc *String `xmlrpc:"email_cc,omitempty"` + EmailFrom *String `xmlrpc:"email_from,omitempty"` + Function *String `xmlrpc:"function,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + KanbanState *Selection `xmlrpc:"kanban_state,omitempty"` + LostReason *Many2One `xmlrpc:"lost_reason,omitempty"` + MachineLeadName *String `xmlrpc:"machine_lead_name,omitempty"` + MediumId *Many2One `xmlrpc:"medium_id,omitempty"` + MeetingCount *Int `xmlrpc:"meeting_count,omitempty"` + MessageBounce *Int `xmlrpc:"message_bounce,omitempty"` + MessageChannelIds *Relation `xmlrpc:"message_channel_ids,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageLastPost *Time `xmlrpc:"message_last_post,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MessageUnread *Bool `xmlrpc:"message_unread,omitempty"` + MessageUnreadCounter *Int `xmlrpc:"message_unread_counter,omitempty"` + Mobile *String `xmlrpc:"mobile,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + OptOut *Bool `xmlrpc:"opt_out,omitempty"` + OrderIds *Relation `xmlrpc:"order_ids,omitempty"` + PartnerAddressEmail *String `xmlrpc:"partner_address_email,omitempty"` + PartnerAddressName *String `xmlrpc:"partner_address_name,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PartnerName *String `xmlrpc:"partner_name,omitempty"` + Phone *String `xmlrpc:"phone,omitempty"` + PlannedRevenue *Float `xmlrpc:"planned_revenue,omitempty"` + Priority *Selection `xmlrpc:"priority,omitempty"` + Probability *Float `xmlrpc:"probability,omitempty"` + Referred *String `xmlrpc:"referred,omitempty"` + SaleAmountTotal *Float `xmlrpc:"sale_amount_total,omitempty"` + SaleNumber *Int `xmlrpc:"sale_number,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"` + UserEmail *String `xmlrpc:"user_email,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + UserLogin *String `xmlrpc:"user_login,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. @@ -154,7 +154,7 @@ func (c *Client) FindCrmLead(criteria *Criteria) (*CrmLead, error) { if cls != nil && len(*cls) > 0 { return &((*cls)[0]), nil } - return nil, fmt.Errorf("crm.lead was not found") + return nil, fmt.Errorf("no crm.lead was found with criteria %v", criteria) } // FindCrmLeads finds crm.lead records by querying it @@ -186,5 +186,5 @@ func (c *Client) FindCrmLeadId(criteria *Criteria, options *Options) (int64, err if len(ids) > 0 { return ids[0], nil } - return -1, fmt.Errorf("crm.lead was not found") + return -1, fmt.Errorf("no crm.lead was found with criteria %v and options %v", criteria, options) } diff --git a/crm_lead2opportunity_partner.go b/crm_lead2opportunity_partner.go new file mode 100644 index 00000000..e283b1b4 --- /dev/null +++ b/crm_lead2opportunity_partner.go @@ -0,0 +1,124 @@ +package odoo + +import ( + "fmt" +) + +// CrmLead2OpportunityPartner represents crm.lead2opportunity.partner model. +type CrmLead2OpportunityPartner struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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"` + Name *Selection `xmlrpc:"name,omitempty"` + OpportunityIds *Relation `xmlrpc:"opportunity_ids,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) { + return c.Create(CrmLead2OpportunityPartnerModel, clp) +} + +// 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) +} + +// 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 + } + if clps != nil && len(*clps) > 0 { + return &((*clps)[0]), nil + } + return nil, fmt.Errorf("id %v of crm.lead2opportunity.partner not found", id) +} + +// 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 + } + if clps != nil && len(*clps) > 0 { + return &((*clps)[0]), nil + } + return nil, fmt.Errorf("no crm.lead2opportunity.partner was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(CrmLead2OpportunityPartnerModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no crm.lead2opportunity.partner was found with criteria %v and options %v", criteria, options) +} diff --git a/crm_lead2opportunity_partner_mass.go b/crm_lead2opportunity_partner_mass.go new file mode 100644 index 00000000..c48d7d05 --- /dev/null +++ b/crm_lead2opportunity_partner_mass.go @@ -0,0 +1,127 @@ +package odoo + +import ( + "fmt" +) + +// CrmLead2OpportunityPartnerMass represents crm.lead2opportunity.partner.mass model. +type CrmLead2OpportunityPartnerMass struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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"` + ForceAssignation *Bool `xmlrpc:"force_assignation,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *Selection `xmlrpc:"name,omitempty"` + OpportunityIds *Relation `xmlrpc:"opportunity_ids,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) { + return c.Create(CrmLead2OpportunityPartnerMassModel, clpm) +} + +// 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) +} + +// 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 + } + if clpms != nil && len(*clpms) > 0 { + return &((*clpms)[0]), nil + } + return nil, fmt.Errorf("id %v of crm.lead2opportunity.partner.mass not found", id) +} + +// 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 + } + if clpms != nil && len(*clpms) > 0 { + return &((*clpms)[0]), nil + } + return nil, fmt.Errorf("no crm.lead2opportunity.partner.mass was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(CrmLead2OpportunityPartnerMassModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no crm.lead2opportunity.partner.mass was found with criteria %v and options %v", criteria, options) +} diff --git a/crm_lead_lost.go b/crm_lead_lost.go new file mode 100644 index 00000000..c2536dab --- /dev/null +++ b/crm_lead_lost.go @@ -0,0 +1,119 @@ +package odoo + +import ( + "fmt" +) + +// CrmLeadLost represents crm.lead.lost model. +type CrmLeadLost struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,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) { + return c.Create(CrmLeadLostModel, cll) +} + +// 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) +} + +// 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 + } + if clls != nil && len(*clls) > 0 { + return &((*clls)[0]), nil + } + return nil, fmt.Errorf("id %v of crm.lead.lost not found", id) +} + +// 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 + } + if clls != nil && len(*clls) > 0 { + return &((*clls)[0]), nil + } + return nil, fmt.Errorf("no crm.lead.lost was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(CrmLeadLostModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no crm.lead.lost was found with criteria %v and options %v", criteria, options) +} diff --git a/crm_lead_tag.go b/crm_lead_tag.go index dba2cde9..8d3eb566 100644 --- a/crm_lead_tag.go +++ b/crm_lead_tag.go @@ -6,15 +6,15 @@ import ( // CrmLeadTag represents crm.lead.tag model. type CrmLeadTag struct { - LastUpdate *Time `xmlrpc:"__last_update,omptempty"` - Color *Int `xmlrpc:"color,omptempty"` - CreateDate *Time `xmlrpc:"create_date,omptempty"` - CreateUid *Many2One `xmlrpc:"create_uid,omptempty"` - DisplayName *String `xmlrpc:"display_name,omptempty"` - Id *Int `xmlrpc:"id,omptempty"` - Name *String `xmlrpc:"name,omptempty"` - WriteDate *Time `xmlrpc:"write_date,omptempty"` - WriteUid *Many2One `xmlrpc:"write_uid,omptempty"` + LastUpdate *Time `xmlrpc:"__last_update,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"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` } // CrmLeadTags represents array of crm.lead.tag model. @@ -84,7 +84,7 @@ func (c *Client) FindCrmLeadTag(criteria *Criteria) (*CrmLeadTag, error) { if clts != nil && len(*clts) > 0 { return &((*clts)[0]), nil } - return nil, fmt.Errorf("crm.lead.tag was not found") + return nil, fmt.Errorf("no crm.lead.tag was found with criteria %v", criteria) } // FindCrmLeadTags finds crm.lead.tag records by querying it @@ -116,5 +116,5 @@ func (c *Client) FindCrmLeadTagId(criteria *Criteria, options *Options) (int64, if len(ids) > 0 { return ids[0], nil } - return -1, fmt.Errorf("crm.lead.tag was not found") + return -1, fmt.Errorf("no crm.lead.tag was found with criteria %v and options %v", criteria, options) } diff --git a/crm_lost_reason.go b/crm_lost_reason.go new file mode 100644 index 00000000..a96529ae --- /dev/null +++ b/crm_lost_reason.go @@ -0,0 +1,120 @@ +package odoo + +import ( + "fmt" +) + +// CrmLostReason represents crm.lost.reason model. +type CrmLostReason struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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"` +} + +// 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) { + return c.Create(CrmLostReasonModel, clr) +} + +// 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) +} + +// 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 + } + if clrs != nil && len(*clrs) > 0 { + return &((*clrs)[0]), nil + } + return nil, fmt.Errorf("id %v of crm.lost.reason not found", id) +} + +// 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 + } + if clrs != nil && len(*clrs) > 0 { + return &((*clrs)[0]), nil + } + return nil, fmt.Errorf("no crm.lost.reason was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(CrmLostReasonModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no crm.lost.reason was found with criteria %v and options %v", criteria, options) +} diff --git a/crm_merge_opportunity.go b/crm_merge_opportunity.go new file mode 100644 index 00000000..95596041 --- /dev/null +++ b/crm_merge_opportunity.go @@ -0,0 +1,121 @@ +package odoo + +import ( + "fmt" +) + +// CrmMergeOpportunity represents crm.merge.opportunity model. +type CrmMergeOpportunity struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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) { + return c.Create(CrmMergeOpportunityModel, cmo) +} + +// 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) +} + +// 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 + } + if cmos != nil && len(*cmos) > 0 { + return &((*cmos)[0]), nil + } + return nil, fmt.Errorf("id %v of crm.merge.opportunity not found", id) +} + +// 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 + } + if cmos != nil && len(*cmos) > 0 { + return &((*cmos)[0]), nil + } + return nil, fmt.Errorf("no crm.merge.opportunity was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(CrmMergeOpportunityModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no crm.merge.opportunity was found with criteria %v and options %v", criteria, options) +} diff --git a/crm_opportunity_report.go b/crm_opportunity_report.go new file mode 100644 index 00000000..69953bcd --- /dev/null +++ b/crm_opportunity_report.go @@ -0,0 +1,142 @@ +package odoo + +import ( + "fmt" +) + +// CrmOpportunityReport represents crm.opportunity.report model. +type CrmOpportunityReport struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + Active *Bool `xmlrpc:"active,omitempty"` + CampaignId *Many2One `xmlrpc:"campaign_id,omitempty"` + City *String `xmlrpc:"city,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CountryId *Many2One `xmlrpc:"country_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,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"` + DelayClose *Float `xmlrpc:"delay_close,omitempty"` + DelayExpected *Float `xmlrpc:"delay_expected,omitempty"` + DelayOpen *Float `xmlrpc:"delay_open,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + ExpectedRevenue *Float `xmlrpc:"expected_revenue,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LostReason *Many2One `xmlrpc:"lost_reason,omitempty"` + MediumId *Many2One `xmlrpc:"medium_id,omitempty"` + NbrActivities *Int `xmlrpc:"nbr_activities,omitempty"` + OpeningDate *Time `xmlrpc:"opening_date,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + Priority *Selection `xmlrpc:"priority,omitempty"` + Probability *Float `xmlrpc:"probability,omitempty"` + SourceId *Many2One `xmlrpc:"source_id,omitempty"` + StageId *Many2One `xmlrpc:"stage_id,omitempty"` + StageName *String `xmlrpc:"stage_name,omitempty"` + TeamId *Many2One `xmlrpc:"team_id,omitempty"` + TotalRevenue *Float `xmlrpc:"total_revenue,omitempty"` + Type *Selection `xmlrpc:"type,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` +} + +// CrmOpportunityReports represents array of crm.opportunity.report model. +type CrmOpportunityReports []CrmOpportunityReport + +// CrmOpportunityReportModel is the odoo model name. +const CrmOpportunityReportModel = "crm.opportunity.report" + +// Many2One convert CrmOpportunityReport to *Many2One. +func (cor *CrmOpportunityReport) Many2One() *Many2One { + return NewMany2One(cor.Id.Get(), "") +} + +// CreateCrmOpportunityReport creates a new crm.opportunity.report model and returns its id. +func (c *Client) CreateCrmOpportunityReport(cor *CrmOpportunityReport) (int64, error) { + return c.Create(CrmOpportunityReportModel, cor) +} + +// UpdateCrmOpportunityReport updates an existing crm.opportunity.report record. +func (c *Client) UpdateCrmOpportunityReport(cor *CrmOpportunityReport) error { + return c.UpdateCrmOpportunityReports([]int64{cor.Id.Get()}, cor) +} + +// UpdateCrmOpportunityReports updates existing crm.opportunity.report records. +// All records (represented by ids) will be updated by cor values. +func (c *Client) UpdateCrmOpportunityReports(ids []int64, cor *CrmOpportunityReport) error { + return c.Update(CrmOpportunityReportModel, ids, cor) +} + +// DeleteCrmOpportunityReport deletes an existing crm.opportunity.report record. +func (c *Client) DeleteCrmOpportunityReport(id int64) error { + return c.DeleteCrmOpportunityReports([]int64{id}) +} + +// DeleteCrmOpportunityReports deletes existing crm.opportunity.report records. +func (c *Client) DeleteCrmOpportunityReports(ids []int64) error { + return c.Delete(CrmOpportunityReportModel, ids) +} + +// GetCrmOpportunityReport gets crm.opportunity.report existing record. +func (c *Client) GetCrmOpportunityReport(id int64) (*CrmOpportunityReport, error) { + cors, err := c.GetCrmOpportunityReports([]int64{id}) + if err != nil { + return nil, err + } + if cors != nil && len(*cors) > 0 { + return &((*cors)[0]), nil + } + return nil, fmt.Errorf("id %v of crm.opportunity.report not found", id) +} + +// GetCrmOpportunityReports gets crm.opportunity.report existing records. +func (c *Client) GetCrmOpportunityReports(ids []int64) (*CrmOpportunityReports, error) { + cors := &CrmOpportunityReports{} + if err := c.Read(CrmOpportunityReportModel, ids, nil, cors); err != nil { + return nil, err + } + return cors, nil +} + +// FindCrmOpportunityReport finds crm.opportunity.report record by querying it with criteria. +func (c *Client) FindCrmOpportunityReport(criteria *Criteria) (*CrmOpportunityReport, error) { + cors := &CrmOpportunityReports{} + if err := c.SearchRead(CrmOpportunityReportModel, criteria, NewOptions().Limit(1), cors); err != nil { + return nil, err + } + if cors != nil && len(*cors) > 0 { + return &((*cors)[0]), nil + } + return nil, fmt.Errorf("no crm.opportunity.report was found with criteria %v", criteria) +} + +// FindCrmOpportunityReports finds crm.opportunity.report records by querying it +// and filtering it with criteria and options. +func (c *Client) FindCrmOpportunityReports(criteria *Criteria, options *Options) (*CrmOpportunityReports, error) { + cors := &CrmOpportunityReports{} + if err := c.SearchRead(CrmOpportunityReportModel, criteria, options, cors); err != nil { + return nil, err + } + return cors, nil +} + +// FindCrmOpportunityReportIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindCrmOpportunityReportIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(CrmOpportunityReportModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindCrmOpportunityReportId finds record id by querying it with criteria. +func (c *Client) FindCrmOpportunityReportId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(CrmOpportunityReportModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no crm.opportunity.report was found with criteria %v and options %v", criteria, options) +} diff --git a/crm_partner_binding.go b/crm_partner_binding.go new file mode 100644 index 00000000..d6cda79b --- /dev/null +++ b/crm_partner_binding.go @@ -0,0 +1,120 @@ +package odoo + +import ( + "fmt" +) + +// CrmPartnerBinding represents crm.partner.binding model. +type CrmPartnerBinding struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// CrmPartnerBindings represents array of crm.partner.binding model. +type CrmPartnerBindings []CrmPartnerBinding + +// CrmPartnerBindingModel is the odoo model name. +const CrmPartnerBindingModel = "crm.partner.binding" + +// Many2One convert CrmPartnerBinding to *Many2One. +func (cpb *CrmPartnerBinding) Many2One() *Many2One { + return NewMany2One(cpb.Id.Get(), "") +} + +// CreateCrmPartnerBinding creates a new crm.partner.binding model and returns its id. +func (c *Client) CreateCrmPartnerBinding(cpb *CrmPartnerBinding) (int64, error) { + return c.Create(CrmPartnerBindingModel, cpb) +} + +// UpdateCrmPartnerBinding updates an existing crm.partner.binding record. +func (c *Client) UpdateCrmPartnerBinding(cpb *CrmPartnerBinding) error { + return c.UpdateCrmPartnerBindings([]int64{cpb.Id.Get()}, cpb) +} + +// UpdateCrmPartnerBindings updates existing crm.partner.binding records. +// All records (represented by ids) will be updated by cpb values. +func (c *Client) UpdateCrmPartnerBindings(ids []int64, cpb *CrmPartnerBinding) error { + return c.Update(CrmPartnerBindingModel, ids, cpb) +} + +// DeleteCrmPartnerBinding deletes an existing crm.partner.binding record. +func (c *Client) DeleteCrmPartnerBinding(id int64) error { + return c.DeleteCrmPartnerBindings([]int64{id}) +} + +// DeleteCrmPartnerBindings deletes existing crm.partner.binding records. +func (c *Client) DeleteCrmPartnerBindings(ids []int64) error { + return c.Delete(CrmPartnerBindingModel, ids) +} + +// GetCrmPartnerBinding gets crm.partner.binding existing record. +func (c *Client) GetCrmPartnerBinding(id int64) (*CrmPartnerBinding, error) { + cpbs, err := c.GetCrmPartnerBindings([]int64{id}) + if err != nil { + return nil, err + } + if cpbs != nil && len(*cpbs) > 0 { + return &((*cpbs)[0]), nil + } + return nil, fmt.Errorf("id %v of crm.partner.binding not found", id) +} + +// GetCrmPartnerBindings gets crm.partner.binding existing records. +func (c *Client) GetCrmPartnerBindings(ids []int64) (*CrmPartnerBindings, error) { + cpbs := &CrmPartnerBindings{} + if err := c.Read(CrmPartnerBindingModel, ids, nil, cpbs); err != nil { + return nil, err + } + return cpbs, nil +} + +// FindCrmPartnerBinding finds crm.partner.binding record by querying it with criteria. +func (c *Client) FindCrmPartnerBinding(criteria *Criteria) (*CrmPartnerBinding, error) { + cpbs := &CrmPartnerBindings{} + if err := c.SearchRead(CrmPartnerBindingModel, criteria, NewOptions().Limit(1), cpbs); err != nil { + return nil, err + } + if cpbs != nil && len(*cpbs) > 0 { + return &((*cpbs)[0]), nil + } + return nil, fmt.Errorf("no crm.partner.binding was found with criteria %v", criteria) +} + +// FindCrmPartnerBindings finds crm.partner.binding records by querying it +// and filtering it with criteria and options. +func (c *Client) FindCrmPartnerBindings(criteria *Criteria, options *Options) (*CrmPartnerBindings, error) { + cpbs := &CrmPartnerBindings{} + if err := c.SearchRead(CrmPartnerBindingModel, criteria, options, cpbs); err != nil { + return nil, err + } + return cpbs, nil +} + +// FindCrmPartnerBindingIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindCrmPartnerBindingIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(CrmPartnerBindingModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindCrmPartnerBindingId finds record id by querying it with criteria. +func (c *Client) FindCrmPartnerBindingId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(CrmPartnerBindingModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no crm.partner.binding was found with criteria %v and options %v", criteria, options) +} diff --git a/crm_stage.go b/crm_stage.go new file mode 100644 index 00000000..d8ef9a2c --- /dev/null +++ b/crm_stage.go @@ -0,0 +1,126 @@ +package odoo + +import ( + "fmt" +) + +// CrmStage represents crm.stage model. +type CrmStage struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` + LegendPriority *String `xmlrpc:"legend_priority,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + OnChange *Bool `xmlrpc:"on_change,omitempty"` + Probability *Float `xmlrpc:"probability,omitempty"` + Requirements *String `xmlrpc:"requirements,omitempty"` + Sequence *Int `xmlrpc:"sequence,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) { + return c.Create(CrmStageModel, cs) +} + +// 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) +} + +// 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 + } + if css != nil && len(*css) > 0 { + return &((*css)[0]), nil + } + return nil, fmt.Errorf("id %v of crm.stage not found", id) +} + +// 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 + } + if css != nil && len(*css) > 0 { + return &((*css)[0]), nil + } + return nil, fmt.Errorf("no crm.stage was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(CrmStageModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no crm.stage was found with criteria %v and options %v", criteria, options) +} diff --git a/crm_team.go b/crm_team.go new file mode 100644 index 00000000..9eebd3ce --- /dev/null +++ b/crm_team.go @@ -0,0 +1,170 @@ +package odoo + +import ( + "fmt" +) + +// CrmTeam represents crm.team model. +type CrmTeam struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + Active *Bool `xmlrpc:"active,omitempty"` + AliasContact *Selection `xmlrpc:"alias_contact,omitempty"` + AliasDefaults *String `xmlrpc:"alias_defaults,omitempty"` + AliasDomain *String `xmlrpc:"alias_domain,omitempty"` + AliasForceThreadId *Int `xmlrpc:"alias_force_thread_id,omitempty"` + AliasId *Many2One `xmlrpc:"alias_id,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"` + AliasUserId *Many2One `xmlrpc:"alias_user_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"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + DashboardButtonName *String `xmlrpc:"dashboard_button_name,omitempty"` + DashboardGraphData *String `xmlrpc:"dashboard_graph_data,omitempty"` + DashboardGraphGroup *Selection `xmlrpc:"dashboard_graph_group,omitempty"` + DashboardGraphGroupPipeline *Selection `xmlrpc:"dashboard_graph_group_pipeline,omitempty"` + DashboardGraphModel *Selection `xmlrpc:"dashboard_graph_model,omitempty"` + DashboardGraphPeriod *Selection `xmlrpc:"dashboard_graph_period,omitempty"` + DashboardGraphPeriodPipeline *Selection `xmlrpc:"dashboard_graph_period_pipeline,omitempty"` + DashboardGraphType *Selection `xmlrpc:"dashboard_graph_type,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + FavoriteUserIds *Relation `xmlrpc:"favorite_user_ids,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Invoiced *Int `xmlrpc:"invoiced,omitempty"` + InvoicedTarget *Int `xmlrpc:"invoiced_target,omitempty"` + IsFavorite *Bool `xmlrpc:"is_favorite,omitempty"` + MemberIds *Relation `xmlrpc:"member_ids,omitempty"` + MessageChannelIds *Relation `xmlrpc:"message_channel_ids,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageLastPost *Time `xmlrpc:"message_last_post,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MessageUnread *Bool `xmlrpc:"message_unread,omitempty"` + MessageUnreadCounter *Int `xmlrpc:"message_unread_counter,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + OpportunitiesAmount *Int `xmlrpc:"opportunities_amount,omitempty"` + OpportunitiesCount *Int `xmlrpc:"opportunities_count,omitempty"` + QuotationsAmount *Int `xmlrpc:"quotations_amount,omitempty"` + QuotationsCount *Int `xmlrpc:"quotations_count,omitempty"` + ReplyTo *String `xmlrpc:"reply_to,omitempty"` + SalesToInvoiceCount *Int `xmlrpc:"sales_to_invoice_count,omitempty"` + TeamType *Selection `xmlrpc:"team_type,omitempty"` + UnassignedLeadsCount *Int `xmlrpc:"unassigned_leads_count,omitempty"` + UseInvoices *Bool `xmlrpc:"use_invoices,omitempty"` + UseLeads *Bool `xmlrpc:"use_leads,omitempty"` + UseOpportunities *Bool `xmlrpc:"use_opportunities,omitempty"` + UseQuotations *Bool `xmlrpc:"use_quotations,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) { + return c.Create(CrmTeamModel, ct) +} + +// 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) +} + +// 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 + } + if cts != nil && len(*cts) > 0 { + return &((*cts)[0]), nil + } + return nil, fmt.Errorf("id %v of crm.team not found", id) +} + +// 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 + } + if cts != nil && len(*cts) > 0 { + return &((*cts)[0]), nil + } + return nil, fmt.Errorf("no crm.team was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(CrmTeamModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no crm.team was found with criteria %v and options %v", criteria, options) +} diff --git a/decimal_precision.go b/decimal_precision.go new file mode 100644 index 00000000..b69a58da --- /dev/null +++ b/decimal_precision.go @@ -0,0 +1,120 @@ +package odoo + +import ( + "fmt" +) + +// DecimalPrecision represents decimal.precision model. +type DecimalPrecision struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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) { + return c.Create(DecimalPrecisionModel, dp) +} + +// 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) +} + +// 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 + } + if dps != nil && len(*dps) > 0 { + return &((*dps)[0]), nil + } + return nil, fmt.Errorf("id %v of decimal.precision not found", id) +} + +// 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 + } + if dps != nil && len(*dps) > 0 { + return &((*dps)[0]), nil + } + return nil, fmt.Errorf("no decimal.precision was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(DecimalPrecisionModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no decimal.precision was found with criteria %v and options %v", criteria, options) +} diff --git a/decimal_precision_test.go b/decimal_precision_test.go new file mode 100644 index 00000000..8a35948f --- /dev/null +++ b/decimal_precision_test.go @@ -0,0 +1,121 @@ +package odoo + +import ( + "fmt" +) + +// DecimalPrecisionTest represents decimal.precision.test model. +type DecimalPrecisionTest struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Float *Float `xmlrpc:"float,omitempty"` + Float2 *Float `xmlrpc:"float_2,omitempty"` + Float4 *Float `xmlrpc:"float_4,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// DecimalPrecisionTests represents array of decimal.precision.test model. +type DecimalPrecisionTests []DecimalPrecisionTest + +// DecimalPrecisionTestModel is the odoo model name. +const DecimalPrecisionTestModel = "decimal.precision.test" + +// Many2One convert DecimalPrecisionTest to *Many2One. +func (dpt *DecimalPrecisionTest) Many2One() *Many2One { + return NewMany2One(dpt.Id.Get(), "") +} + +// CreateDecimalPrecisionTest creates a new decimal.precision.test model and returns its id. +func (c *Client) CreateDecimalPrecisionTest(dpt *DecimalPrecisionTest) (int64, error) { + return c.Create(DecimalPrecisionTestModel, dpt) +} + +// UpdateDecimalPrecisionTest updates an existing decimal.precision.test record. +func (c *Client) UpdateDecimalPrecisionTest(dpt *DecimalPrecisionTest) error { + return c.UpdateDecimalPrecisionTests([]int64{dpt.Id.Get()}, dpt) +} + +// UpdateDecimalPrecisionTests updates existing decimal.precision.test records. +// All records (represented by ids) will be updated by dpt values. +func (c *Client) UpdateDecimalPrecisionTests(ids []int64, dpt *DecimalPrecisionTest) error { + return c.Update(DecimalPrecisionTestModel, ids, dpt) +} + +// DeleteDecimalPrecisionTest deletes an existing decimal.precision.test record. +func (c *Client) DeleteDecimalPrecisionTest(id int64) error { + return c.DeleteDecimalPrecisionTests([]int64{id}) +} + +// DeleteDecimalPrecisionTests deletes existing decimal.precision.test records. +func (c *Client) DeleteDecimalPrecisionTests(ids []int64) error { + return c.Delete(DecimalPrecisionTestModel, ids) +} + +// GetDecimalPrecisionTest gets decimal.precision.test existing record. +func (c *Client) GetDecimalPrecisionTest(id int64) (*DecimalPrecisionTest, error) { + dpts, err := c.GetDecimalPrecisionTests([]int64{id}) + if err != nil { + return nil, err + } + if dpts != nil && len(*dpts) > 0 { + return &((*dpts)[0]), nil + } + return nil, fmt.Errorf("id %v of decimal.precision.test not found", id) +} + +// GetDecimalPrecisionTests gets decimal.precision.test existing records. +func (c *Client) GetDecimalPrecisionTests(ids []int64) (*DecimalPrecisionTests, error) { + dpts := &DecimalPrecisionTests{} + if err := c.Read(DecimalPrecisionTestModel, ids, nil, dpts); err != nil { + return nil, err + } + return dpts, nil +} + +// FindDecimalPrecisionTest finds decimal.precision.test record by querying it with criteria. +func (c *Client) FindDecimalPrecisionTest(criteria *Criteria) (*DecimalPrecisionTest, error) { + dpts := &DecimalPrecisionTests{} + if err := c.SearchRead(DecimalPrecisionTestModel, criteria, NewOptions().Limit(1), dpts); err != nil { + return nil, err + } + if dpts != nil && len(*dpts) > 0 { + return &((*dpts)[0]), nil + } + return nil, fmt.Errorf("no decimal.precision.test was found with criteria %v", criteria) +} + +// FindDecimalPrecisionTests finds decimal.precision.test records by querying it +// and filtering it with criteria and options. +func (c *Client) FindDecimalPrecisionTests(criteria *Criteria, options *Options) (*DecimalPrecisionTests, error) { + dpts := &DecimalPrecisionTests{} + if err := c.SearchRead(DecimalPrecisionTestModel, criteria, options, dpts); err != nil { + return nil, err + } + return dpts, nil +} + +// FindDecimalPrecisionTestIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindDecimalPrecisionTestIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(DecimalPrecisionTestModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindDecimalPrecisionTestId finds record id by querying it with criteria. +func (c *Client) FindDecimalPrecisionTestId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(DecimalPrecisionTestModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no decimal.precision.test was found with criteria %v and options %v", criteria, options) +} diff --git a/email_template_preview.go b/email_template_preview.go new file mode 100644 index 00000000..91a272b1 --- /dev/null +++ b/email_template_preview.go @@ -0,0 +1,145 @@ +package odoo + +import ( + "fmt" +) + +// EmailTemplatePreview represents email_template.preview model. +type EmailTemplatePreview struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AttachmentIds *Relation `xmlrpc:"attachment_ids,omitempty"` + AutoDelete *Bool `xmlrpc:"auto_delete,omitempty"` + BodyHtml *String `xmlrpc:"body_html,omitempty"` + Copyvalue *String `xmlrpc:"copyvalue,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"` + Id *Int `xmlrpc:"id,omitempty"` + Lang *String `xmlrpc:"lang,omitempty"` + MailServerId *Many2One `xmlrpc:"mail_server_id,omitempty"` + Model *String `xmlrpc:"model,omitempty"` + ModelId *Many2One `xmlrpc:"model_id,omitempty"` + ModelObjectField *Many2One `xmlrpc:"model_object_field,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + NullValue *String `xmlrpc:"null_value,omitempty"` + PartnerIds *Relation `xmlrpc:"partner_ids,omitempty"` + PartnerTo *String `xmlrpc:"partner_to,omitempty"` + RefIrActWindow *Many2One `xmlrpc:"ref_ir_act_window,omitempty"` + ReplyTo *String `xmlrpc:"reply_to,omitempty"` + ReportName *String `xmlrpc:"report_name,omitempty"` + ReportTemplate *Many2One `xmlrpc:"report_template,omitempty"` + ResId *Selection `xmlrpc:"res_id,omitempty"` + ScheduledDate *String `xmlrpc:"scheduled_date,omitempty"` + SubModelObjectField *Many2One `xmlrpc:"sub_model_object_field,omitempty"` + SubObject *Many2One `xmlrpc:"sub_object,omitempty"` + Subject *String `xmlrpc:"subject,omitempty"` + UseDefaultTo *Bool `xmlrpc:"use_default_to,omitempty"` + UserSignature *Bool `xmlrpc:"user_signature,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// EmailTemplatePreviews represents array of email_template.preview model. +type EmailTemplatePreviews []EmailTemplatePreview + +// EmailTemplatePreviewModel is the odoo model name. +const EmailTemplatePreviewModel = "email_template.preview" + +// Many2One convert EmailTemplatePreview to *Many2One. +func (ep *EmailTemplatePreview) Many2One() *Many2One { + return NewMany2One(ep.Id.Get(), "") +} + +// CreateEmailTemplatePreview creates a new email_template.preview model and returns its id. +func (c *Client) CreateEmailTemplatePreview(ep *EmailTemplatePreview) (int64, error) { + return c.Create(EmailTemplatePreviewModel, ep) +} + +// UpdateEmailTemplatePreview updates an existing email_template.preview record. +func (c *Client) UpdateEmailTemplatePreview(ep *EmailTemplatePreview) error { + return c.UpdateEmailTemplatePreviews([]int64{ep.Id.Get()}, ep) +} + +// UpdateEmailTemplatePreviews updates existing email_template.preview records. +// All records (represented by ids) will be updated by ep values. +func (c *Client) UpdateEmailTemplatePreviews(ids []int64, ep *EmailTemplatePreview) error { + return c.Update(EmailTemplatePreviewModel, ids, ep) +} + +// DeleteEmailTemplatePreview deletes an existing email_template.preview record. +func (c *Client) DeleteEmailTemplatePreview(id int64) error { + return c.DeleteEmailTemplatePreviews([]int64{id}) +} + +// DeleteEmailTemplatePreviews deletes existing email_template.preview records. +func (c *Client) DeleteEmailTemplatePreviews(ids []int64) error { + return c.Delete(EmailTemplatePreviewModel, ids) +} + +// GetEmailTemplatePreview gets email_template.preview existing record. +func (c *Client) GetEmailTemplatePreview(id int64) (*EmailTemplatePreview, error) { + eps, err := c.GetEmailTemplatePreviews([]int64{id}) + if err != nil { + return nil, err + } + if eps != nil && len(*eps) > 0 { + return &((*eps)[0]), nil + } + return nil, fmt.Errorf("id %v of email_template.preview not found", id) +} + +// GetEmailTemplatePreviews gets email_template.preview existing records. +func (c *Client) GetEmailTemplatePreviews(ids []int64) (*EmailTemplatePreviews, error) { + eps := &EmailTemplatePreviews{} + if err := c.Read(EmailTemplatePreviewModel, ids, nil, eps); err != nil { + return nil, err + } + return eps, nil +} + +// FindEmailTemplatePreview finds email_template.preview record by querying it with criteria. +func (c *Client) FindEmailTemplatePreview(criteria *Criteria) (*EmailTemplatePreview, error) { + eps := &EmailTemplatePreviews{} + if err := c.SearchRead(EmailTemplatePreviewModel, criteria, NewOptions().Limit(1), eps); err != nil { + return nil, err + } + if eps != nil && len(*eps) > 0 { + return &((*eps)[0]), nil + } + return nil, fmt.Errorf("no email_template.preview was found with criteria %v", criteria) +} + +// FindEmailTemplatePreviews finds email_template.preview records by querying it +// and filtering it with criteria and options. +func (c *Client) FindEmailTemplatePreviews(criteria *Criteria, options *Options) (*EmailTemplatePreviews, error) { + eps := &EmailTemplatePreviews{} + if err := c.SearchRead(EmailTemplatePreviewModel, criteria, options, eps); err != nil { + return nil, err + } + return eps, nil +} + +// FindEmailTemplatePreviewIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindEmailTemplatePreviewIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(EmailTemplatePreviewModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindEmailTemplatePreviewId finds record id by querying it with criteria. +func (c *Client) FindEmailTemplatePreviewId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(EmailTemplatePreviewModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no email_template.preview was found with criteria %v and options %v", criteria, options) +} diff --git a/fetchmail_server.go b/fetchmail_server.go new file mode 100644 index 00000000..f3cf9797 --- /dev/null +++ b/fetchmail_server.go @@ -0,0 +1,136 @@ +package odoo + +import ( + "fmt" +) + +// FetchmailServer represents fetchmail.server model. +type FetchmailServer struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + ActionId *Many2One `xmlrpc:"action_id,omitempty"` + 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"` + 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"` + State *Selection `xmlrpc:"state,omitempty"` + Type *Selection `xmlrpc:"type,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) { + return c.Create(FetchmailServerModel, fs) +} + +// 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) +} + +// 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 + } + if fss != nil && len(*fss) > 0 { + return &((*fss)[0]), nil + } + return nil, fmt.Errorf("id %v of fetchmail.server not found", id) +} + +// 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 + } + if fss != nil && len(*fss) > 0 { + return &((*fss)[0]), nil + } + return nil, fmt.Errorf("no fetchmail.server was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(FetchmailServerModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no fetchmail.server was found with criteria %v and options %v", criteria, options) +} diff --git a/format_address_mixin.go b/format_address_mixin.go new file mode 100644 index 00000000..c5c381b2 --- /dev/null +++ b/format_address_mixin.go @@ -0,0 +1,114 @@ +package odoo + +import ( + "fmt" +) + +// FormatAddressMixin represents format.address.mixin model. +type FormatAddressMixin struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` +} + +// FormatAddressMixins represents array of format.address.mixin model. +type FormatAddressMixins []FormatAddressMixin + +// FormatAddressMixinModel is the odoo model name. +const FormatAddressMixinModel = "format.address.mixin" + +// Many2One convert FormatAddressMixin to *Many2One. +func (fam *FormatAddressMixin) Many2One() *Many2One { + return NewMany2One(fam.Id.Get(), "") +} + +// CreateFormatAddressMixin creates a new format.address.mixin model and returns its id. +func (c *Client) CreateFormatAddressMixin(fam *FormatAddressMixin) (int64, error) { + return c.Create(FormatAddressMixinModel, fam) +} + +// UpdateFormatAddressMixin updates an existing format.address.mixin record. +func (c *Client) UpdateFormatAddressMixin(fam *FormatAddressMixin) error { + return c.UpdateFormatAddressMixins([]int64{fam.Id.Get()}, fam) +} + +// UpdateFormatAddressMixins updates existing format.address.mixin records. +// All records (represented by ids) will be updated by fam values. +func (c *Client) UpdateFormatAddressMixins(ids []int64, fam *FormatAddressMixin) error { + return c.Update(FormatAddressMixinModel, ids, fam) +} + +// DeleteFormatAddressMixin deletes an existing format.address.mixin record. +func (c *Client) DeleteFormatAddressMixin(id int64) error { + return c.DeleteFormatAddressMixins([]int64{id}) +} + +// DeleteFormatAddressMixins deletes existing format.address.mixin records. +func (c *Client) DeleteFormatAddressMixins(ids []int64) error { + return c.Delete(FormatAddressMixinModel, ids) +} + +// GetFormatAddressMixin gets format.address.mixin existing record. +func (c *Client) GetFormatAddressMixin(id int64) (*FormatAddressMixin, error) { + fams, err := c.GetFormatAddressMixins([]int64{id}) + if err != nil { + return nil, err + } + if fams != nil && len(*fams) > 0 { + return &((*fams)[0]), nil + } + return nil, fmt.Errorf("id %v of format.address.mixin not found", id) +} + +// GetFormatAddressMixins gets format.address.mixin existing records. +func (c *Client) GetFormatAddressMixins(ids []int64) (*FormatAddressMixins, error) { + fams := &FormatAddressMixins{} + if err := c.Read(FormatAddressMixinModel, ids, nil, fams); err != nil { + return nil, err + } + return fams, nil +} + +// FindFormatAddressMixin finds format.address.mixin record by querying it with criteria. +func (c *Client) FindFormatAddressMixin(criteria *Criteria) (*FormatAddressMixin, error) { + fams := &FormatAddressMixins{} + if err := c.SearchRead(FormatAddressMixinModel, criteria, NewOptions().Limit(1), fams); err != nil { + return nil, err + } + if fams != nil && len(*fams) > 0 { + return &((*fams)[0]), nil + } + return nil, fmt.Errorf("no format.address.mixin was found with criteria %v", criteria) +} + +// FindFormatAddressMixins finds format.address.mixin records by querying it +// and filtering it with criteria and options. +func (c *Client) FindFormatAddressMixins(criteria *Criteria, options *Options) (*FormatAddressMixins, error) { + fams := &FormatAddressMixins{} + if err := c.SearchRead(FormatAddressMixinModel, criteria, options, fams); err != nil { + return nil, err + } + return fams, nil +} + +// FindFormatAddressMixinIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindFormatAddressMixinIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(FormatAddressMixinModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindFormatAddressMixinId finds record id by querying it with criteria. +func (c *Client) FindFormatAddressMixinId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(FormatAddressMixinModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no format.address.mixin was found with criteria %v and options %v", criteria, options) +} diff --git a/generator/cmd/tmpl/model.tmpl b/generator/cmd/tmpl/model.tmpl index 6bbd5c8e..29f481c6 100644 --- a/generator/cmd/tmpl/model.tmpl +++ b/generator/cmd/tmpl/model.tmpl @@ -76,7 +76,7 @@ func (c *Client) Find{{.StructName}}(criteria *Criteria) (*{{.StructName}}, erro if {{.VarsName}} != nil && len(*{{.VarsName}}) > 0 { return &((*{{.VarsName}})[0]), nil } - return nil, fmt.Errorf("{{ .Name }} was not found") + return nil, fmt.Errorf("no {{ .Name }} was found with criteria %v", criteria) } // Find{{.StructName}}s finds {{ .Name }} records by querying it @@ -108,5 +108,5 @@ func (c *Client) Find{{.StructName}}Id(criteria *Criteria, options *Options) (in if len(ids) > 0 { return ids[0], nil } - return -1, fmt.Errorf("{{ .Name }} was not found") + return -1, fmt.Errorf("no {{ .Name }} was found with criteria %v and options %v", criteria, options) } diff --git a/hr_department.go b/hr_department.go new file mode 100644 index 00000000..c1d30818 --- /dev/null +++ b/hr_department.go @@ -0,0 +1,144 @@ +package odoo + +import ( + "fmt" +) + +// HrDepartment represents hr.department model. +type HrDepartment struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AbsenceOfToday *Int `xmlrpc:"absence_of_today,omitempty"` + Active *Bool `xmlrpc:"active,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"` + 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"` + MemberIds *Relation `xmlrpc:"member_ids,omitempty"` + MessageChannelIds *Relation `xmlrpc:"message_channel_ids,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageLastPost *Time `xmlrpc:"message_last_post,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MessageUnread *Bool `xmlrpc:"message_unread,omitempty"` + MessageUnreadCounter *Int `xmlrpc:"message_unread_counter,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Note *String `xmlrpc:"note,omitempty"` + ParentId *Many2One `xmlrpc:"parent_id,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) { + return c.Create(HrDepartmentModel, hd) +} + +// 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) +} + +// 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 + } + if hds != nil && len(*hds) > 0 { + return &((*hds)[0]), nil + } + return nil, fmt.Errorf("id %v of hr.department not found", id) +} + +// 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 + } + if hds != nil && len(*hds) > 0 { + return &((*hds)[0]), nil + } + return nil, fmt.Errorf("no hr.department was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(HrDepartmentModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no hr.department was found with criteria %v and options %v", criteria, options) +} diff --git a/hr_employee.go b/hr_employee.go new file mode 100644 index 00000000..1e71b71c --- /dev/null +++ b/hr_employee.go @@ -0,0 +1,176 @@ +package odoo + +import ( + "fmt" +) + +// HrEmployee represents hr.employee model. +type HrEmployee struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + Active *Bool `xmlrpc:"active,omitempty"` + AddressHomeId *Many2One `xmlrpc:"address_home_id,omitempty"` + AddressId *Many2One `xmlrpc:"address_id,omitempty"` + BankAccountId *Many2One `xmlrpc:"bank_account_id,omitempty"` + Birthday *Time `xmlrpc:"birthday,omitempty"` + CategoryIds *Relation `xmlrpc:"category_ids,omitempty"` + ChildAllCount *Int `xmlrpc:"child_all_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"` + CountryId *Many2One `xmlrpc:"country_id,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"` + DepartmentId *Many2One `xmlrpc:"department_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Gender *Selection `xmlrpc:"gender,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IdentificationId *String `xmlrpc:"identification_id,omitempty"` + Image *String `xmlrpc:"image,omitempty"` + ImageMedium *String `xmlrpc:"image_medium,omitempty"` + ImageSmall *String `xmlrpc:"image_small,omitempty"` + IsAbsentTotay *Bool `xmlrpc:"is_absent_totay,omitempty"` + IsAddressHomeACompany *Bool `xmlrpc:"is_address_home_a_company,omitempty"` + JobId *Many2One `xmlrpc:"job_id,omitempty"` + LeaveDateFrom *Time `xmlrpc:"leave_date_from,omitempty"` + LeaveDateTo *Time `xmlrpc:"leave_date_to,omitempty"` + LeavesCount *Float `xmlrpc:"leaves_count,omitempty"` + Marital *Selection `xmlrpc:"marital,omitempty"` + MessageChannelIds *Relation `xmlrpc:"message_channel_ids,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageLastPost *Time `xmlrpc:"message_last_post,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MessageUnread *Bool `xmlrpc:"message_unread,omitempty"` + MessageUnreadCounter *Int `xmlrpc:"message_unread_counter,omitempty"` + MobilePhone *String `xmlrpc:"mobile_phone,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Notes *String `xmlrpc:"notes,omitempty"` + ParentId *Many2One `xmlrpc:"parent_id,omitempty"` + PassportId *String `xmlrpc:"passport_id,omitempty"` + PermitNo *String `xmlrpc:"permit_no,omitempty"` + RemainingLeaves *Float `xmlrpc:"remaining_leaves,omitempty"` + ResourceCalendarId *Many2One `xmlrpc:"resource_calendar_id,omitempty"` + ResourceId *Many2One `xmlrpc:"resource_id,omitempty"` + ShowLeaves *Bool `xmlrpc:"show_leaves,omitempty"` + Sinid *String `xmlrpc:"sinid,omitempty"` + Ssnid *String `xmlrpc:"ssnid,omitempty"` + TimesheetCost *Float `xmlrpc:"timesheet_cost,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + VisaExpire *Time `xmlrpc:"visa_expire,omitempty"` + VisaNo *String `xmlrpc:"visa_no,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + WorkEmail *String `xmlrpc:"work_email,omitempty"` + WorkLocation *String `xmlrpc:"work_location,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) { + return c.Create(HrEmployeeModel, he) +} + +// 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) +} + +// 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 + } + if hes != nil && len(*hes) > 0 { + return &((*hes)[0]), nil + } + return nil, fmt.Errorf("id %v of hr.employee not found", id) +} + +// 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 + } + if hes != nil && len(*hes) > 0 { + return &((*hes)[0]), nil + } + return nil, fmt.Errorf("no hr.employee was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(HrEmployeeModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no hr.employee was found with criteria %v and options %v", criteria, options) +} diff --git a/hr_employee_category.go b/hr_employee_category.go new file mode 100644 index 00000000..c74179c4 --- /dev/null +++ b/hr_employee_category.go @@ -0,0 +1,121 @@ +package odoo + +import ( + "fmt" +) + +// HrEmployeeCategory represents hr.employee.category model. +type HrEmployeeCategory struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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) { + return c.Create(HrEmployeeCategoryModel, hec) +} + +// 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) +} + +// 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 + } + if hecs != nil && len(*hecs) > 0 { + return &((*hecs)[0]), nil + } + return nil, fmt.Errorf("id %v of hr.employee.category not found", id) +} + +// 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 + } + if hecs != nil && len(*hecs) > 0 { + return &((*hecs)[0]), nil + } + return nil, fmt.Errorf("no hr.employee.category was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(HrEmployeeCategoryModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no hr.employee.category was found with criteria %v and options %v", criteria, options) +} diff --git a/hr_holidays.go b/hr_holidays.go new file mode 100644 index 00000000..b7a5c5bd --- /dev/null +++ b/hr_holidays.go @@ -0,0 +1,154 @@ +package odoo + +import ( + "fmt" +) + +// HrHolidays represents hr.holidays model. +type HrHolidays struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CanReset *Bool `xmlrpc:"can_reset,omitempty"` + CategoryId *Many2One `xmlrpc:"category_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"` + DoubleValidation *Bool `xmlrpc:"double_validation,omitempty"` + EmployeeId *Many2One `xmlrpc:"employee_id,omitempty"` + FirstApproverId *Many2One `xmlrpc:"first_approver_id,omitempty"` + HolidayStatusId *Many2One `xmlrpc:"holiday_status_id,omitempty"` + HolidayType *Selection `xmlrpc:"holiday_type,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LinkedRequestIds *Relation `xmlrpc:"linked_request_ids,omitempty"` + ManagerId *Many2One `xmlrpc:"manager_id,omitempty"` + MeetingId *Many2One `xmlrpc:"meeting_id,omitempty"` + MessageChannelIds *Relation `xmlrpc:"message_channel_ids,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageLastPost *Time `xmlrpc:"message_last_post,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MessageUnread *Bool `xmlrpc:"message_unread,omitempty"` + MessageUnreadCounter *Int `xmlrpc:"message_unread_counter,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Notes *String `xmlrpc:"notes,omitempty"` + NumberOfDays *Float `xmlrpc:"number_of_days,omitempty"` + NumberOfDaysTemp *Float `xmlrpc:"number_of_days_temp,omitempty"` + ParentId *Many2One `xmlrpc:"parent_id,omitempty"` + PayslipStatus *Bool `xmlrpc:"payslip_status,omitempty"` + ReportNote *String `xmlrpc:"report_note,omitempty"` + SecondApproverId *Many2One `xmlrpc:"second_approver_id,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + TimesheetIds *Relation `xmlrpc:"timesheet_ids,omitempty"` + Type *Selection `xmlrpc:"type,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"` +} + +// HrHolidayss represents array of hr.holidays model. +type HrHolidayss []HrHolidays + +// HrHolidaysModel is the odoo model name. +const HrHolidaysModel = "hr.holidays" + +// Many2One convert HrHolidays to *Many2One. +func (hh *HrHolidays) Many2One() *Many2One { + return NewMany2One(hh.Id.Get(), "") +} + +// CreateHrHolidays creates a new hr.holidays model and returns its id. +func (c *Client) CreateHrHolidays(hh *HrHolidays) (int64, error) { + return c.Create(HrHolidaysModel, hh) +} + +// UpdateHrHolidays updates an existing hr.holidays record. +func (c *Client) UpdateHrHolidays(hh *HrHolidays) error { + return c.UpdateHrHolidayss([]int64{hh.Id.Get()}, hh) +} + +// UpdateHrHolidayss updates existing hr.holidays records. +// All records (represented by ids) will be updated by hh values. +func (c *Client) UpdateHrHolidayss(ids []int64, hh *HrHolidays) error { + return c.Update(HrHolidaysModel, ids, hh) +} + +// DeleteHrHolidays deletes an existing hr.holidays record. +func (c *Client) DeleteHrHolidays(id int64) error { + return c.DeleteHrHolidayss([]int64{id}) +} + +// DeleteHrHolidayss deletes existing hr.holidays records. +func (c *Client) DeleteHrHolidayss(ids []int64) error { + return c.Delete(HrHolidaysModel, ids) +} + +// GetHrHolidays gets hr.holidays existing record. +func (c *Client) GetHrHolidays(id int64) (*HrHolidays, error) { + hhs, err := c.GetHrHolidayss([]int64{id}) + if err != nil { + return nil, err + } + if hhs != nil && len(*hhs) > 0 { + return &((*hhs)[0]), nil + } + return nil, fmt.Errorf("id %v of hr.holidays not found", id) +} + +// GetHrHolidayss gets hr.holidays existing records. +func (c *Client) GetHrHolidayss(ids []int64) (*HrHolidayss, error) { + hhs := &HrHolidayss{} + if err := c.Read(HrHolidaysModel, ids, nil, hhs); err != nil { + return nil, err + } + return hhs, nil +} + +// FindHrHolidays finds hr.holidays record by querying it with criteria. +func (c *Client) FindHrHolidays(criteria *Criteria) (*HrHolidays, error) { + hhs := &HrHolidayss{} + if err := c.SearchRead(HrHolidaysModel, criteria, NewOptions().Limit(1), hhs); err != nil { + return nil, err + } + if hhs != nil && len(*hhs) > 0 { + return &((*hhs)[0]), nil + } + return nil, fmt.Errorf("no hr.holidays was found with criteria %v", criteria) +} + +// FindHrHolidayss finds hr.holidays records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrHolidayss(criteria *Criteria, options *Options) (*HrHolidayss, error) { + hhs := &HrHolidayss{} + if err := c.SearchRead(HrHolidaysModel, criteria, options, hhs); err != nil { + return nil, err + } + return hhs, nil +} + +// FindHrHolidaysIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrHolidaysIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(HrHolidaysModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindHrHolidaysId finds record id by querying it with criteria. +func (c *Client) FindHrHolidaysId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrHolidaysModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no hr.holidays was found with criteria %v and options %v", criteria, options) +} diff --git a/hr_holidays_remaining_leaves_user.go b/hr_holidays_remaining_leaves_user.go new file mode 100644 index 00000000..eac060a8 --- /dev/null +++ b/hr_holidays_remaining_leaves_user.go @@ -0,0 +1,118 @@ +package odoo + +import ( + "fmt" +) + +// HrHolidaysRemainingLeavesUser represents hr.holidays.remaining.leaves.user model. +type HrHolidaysRemainingLeavesUser struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LeaveType *String `xmlrpc:"leave_type,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + NoOfLeaves *Int `xmlrpc:"no_of_leaves,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` +} + +// HrHolidaysRemainingLeavesUsers represents array of hr.holidays.remaining.leaves.user model. +type HrHolidaysRemainingLeavesUsers []HrHolidaysRemainingLeavesUser + +// HrHolidaysRemainingLeavesUserModel is the odoo model name. +const HrHolidaysRemainingLeavesUserModel = "hr.holidays.remaining.leaves.user" + +// Many2One convert HrHolidaysRemainingLeavesUser to *Many2One. +func (hhrlu *HrHolidaysRemainingLeavesUser) Many2One() *Many2One { + return NewMany2One(hhrlu.Id.Get(), "") +} + +// CreateHrHolidaysRemainingLeavesUser creates a new hr.holidays.remaining.leaves.user model and returns its id. +func (c *Client) CreateHrHolidaysRemainingLeavesUser(hhrlu *HrHolidaysRemainingLeavesUser) (int64, error) { + return c.Create(HrHolidaysRemainingLeavesUserModel, hhrlu) +} + +// UpdateHrHolidaysRemainingLeavesUser updates an existing hr.holidays.remaining.leaves.user record. +func (c *Client) UpdateHrHolidaysRemainingLeavesUser(hhrlu *HrHolidaysRemainingLeavesUser) error { + return c.UpdateHrHolidaysRemainingLeavesUsers([]int64{hhrlu.Id.Get()}, hhrlu) +} + +// UpdateHrHolidaysRemainingLeavesUsers updates existing hr.holidays.remaining.leaves.user records. +// All records (represented by ids) will be updated by hhrlu values. +func (c *Client) UpdateHrHolidaysRemainingLeavesUsers(ids []int64, hhrlu *HrHolidaysRemainingLeavesUser) error { + return c.Update(HrHolidaysRemainingLeavesUserModel, ids, hhrlu) +} + +// DeleteHrHolidaysRemainingLeavesUser deletes an existing hr.holidays.remaining.leaves.user record. +func (c *Client) DeleteHrHolidaysRemainingLeavesUser(id int64) error { + return c.DeleteHrHolidaysRemainingLeavesUsers([]int64{id}) +} + +// DeleteHrHolidaysRemainingLeavesUsers deletes existing hr.holidays.remaining.leaves.user records. +func (c *Client) DeleteHrHolidaysRemainingLeavesUsers(ids []int64) error { + return c.Delete(HrHolidaysRemainingLeavesUserModel, ids) +} + +// GetHrHolidaysRemainingLeavesUser gets hr.holidays.remaining.leaves.user existing record. +func (c *Client) GetHrHolidaysRemainingLeavesUser(id int64) (*HrHolidaysRemainingLeavesUser, error) { + hhrlus, err := c.GetHrHolidaysRemainingLeavesUsers([]int64{id}) + if err != nil { + return nil, err + } + if hhrlus != nil && len(*hhrlus) > 0 { + return &((*hhrlus)[0]), nil + } + return nil, fmt.Errorf("id %v of hr.holidays.remaining.leaves.user not found", id) +} + +// GetHrHolidaysRemainingLeavesUsers gets hr.holidays.remaining.leaves.user existing records. +func (c *Client) GetHrHolidaysRemainingLeavesUsers(ids []int64) (*HrHolidaysRemainingLeavesUsers, error) { + hhrlus := &HrHolidaysRemainingLeavesUsers{} + if err := c.Read(HrHolidaysRemainingLeavesUserModel, ids, nil, hhrlus); err != nil { + return nil, err + } + return hhrlus, nil +} + +// FindHrHolidaysRemainingLeavesUser finds hr.holidays.remaining.leaves.user record by querying it with criteria. +func (c *Client) FindHrHolidaysRemainingLeavesUser(criteria *Criteria) (*HrHolidaysRemainingLeavesUser, error) { + hhrlus := &HrHolidaysRemainingLeavesUsers{} + if err := c.SearchRead(HrHolidaysRemainingLeavesUserModel, criteria, NewOptions().Limit(1), hhrlus); err != nil { + return nil, err + } + if hhrlus != nil && len(*hhrlus) > 0 { + return &((*hhrlus)[0]), nil + } + return nil, fmt.Errorf("no hr.holidays.remaining.leaves.user was found with criteria %v", criteria) +} + +// FindHrHolidaysRemainingLeavesUsers finds hr.holidays.remaining.leaves.user records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrHolidaysRemainingLeavesUsers(criteria *Criteria, options *Options) (*HrHolidaysRemainingLeavesUsers, error) { + hhrlus := &HrHolidaysRemainingLeavesUsers{} + if err := c.SearchRead(HrHolidaysRemainingLeavesUserModel, criteria, options, hhrlus); err != nil { + return nil, err + } + return hhrlus, nil +} + +// FindHrHolidaysRemainingLeavesUserIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrHolidaysRemainingLeavesUserIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(HrHolidaysRemainingLeavesUserModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindHrHolidaysRemainingLeavesUserId finds record id by querying it with criteria. +func (c *Client) FindHrHolidaysRemainingLeavesUserId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrHolidaysRemainingLeavesUserModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no hr.holidays.remaining.leaves.user was found with criteria %v and options %v", criteria, options) +} diff --git a/hr_holidays_status.go b/hr_holidays_status.go new file mode 100644 index 00000000..6629667b --- /dev/null +++ b/hr_holidays_status.go @@ -0,0 +1,132 @@ +package odoo + +import ( + "fmt" +) + +// HrHolidaysStatus represents hr.holidays.status model. +type HrHolidaysStatus struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + Active *Bool `xmlrpc:"active,omitempty"` + CategId *Many2One `xmlrpc:"categ_id,omitempty"` + ColorName *Selection `xmlrpc:"color_name,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"` + DoubleValidation *Bool `xmlrpc:"double_validation,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LeavesTaken *Float `xmlrpc:"leaves_taken,omitempty"` + Limit *Bool `xmlrpc:"limit,omitempty"` + MaxLeaves *Float `xmlrpc:"max_leaves,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + RemainingLeaves *Float `xmlrpc:"remaining_leaves,omitempty"` + TimesheetGenerate *Bool `xmlrpc:"timesheet_generate,omitempty"` + TimesheetProjectId *Many2One `xmlrpc:"timesheet_project_id,omitempty"` + TimesheetTaskId *Many2One `xmlrpc:"timesheet_task_id,omitempty"` + VirtualRemainingLeaves *Float `xmlrpc:"virtual_remaining_leaves,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// HrHolidaysStatuss represents array of hr.holidays.status model. +type HrHolidaysStatuss []HrHolidaysStatus + +// HrHolidaysStatusModel is the odoo model name. +const HrHolidaysStatusModel = "hr.holidays.status" + +// Many2One convert HrHolidaysStatus to *Many2One. +func (hhs *HrHolidaysStatus) Many2One() *Many2One { + return NewMany2One(hhs.Id.Get(), "") +} + +// CreateHrHolidaysStatus creates a new hr.holidays.status model and returns its id. +func (c *Client) CreateHrHolidaysStatus(hhs *HrHolidaysStatus) (int64, error) { + return c.Create(HrHolidaysStatusModel, hhs) +} + +// UpdateHrHolidaysStatus updates an existing hr.holidays.status record. +func (c *Client) UpdateHrHolidaysStatus(hhs *HrHolidaysStatus) error { + return c.UpdateHrHolidaysStatuss([]int64{hhs.Id.Get()}, hhs) +} + +// UpdateHrHolidaysStatuss updates existing hr.holidays.status records. +// All records (represented by ids) will be updated by hhs values. +func (c *Client) UpdateHrHolidaysStatuss(ids []int64, hhs *HrHolidaysStatus) error { + return c.Update(HrHolidaysStatusModel, ids, hhs) +} + +// DeleteHrHolidaysStatus deletes an existing hr.holidays.status record. +func (c *Client) DeleteHrHolidaysStatus(id int64) error { + return c.DeleteHrHolidaysStatuss([]int64{id}) +} + +// DeleteHrHolidaysStatuss deletes existing hr.holidays.status records. +func (c *Client) DeleteHrHolidaysStatuss(ids []int64) error { + return c.Delete(HrHolidaysStatusModel, ids) +} + +// GetHrHolidaysStatus gets hr.holidays.status existing record. +func (c *Client) GetHrHolidaysStatus(id int64) (*HrHolidaysStatus, error) { + hhss, err := c.GetHrHolidaysStatuss([]int64{id}) + if err != nil { + return nil, err + } + if hhss != nil && len(*hhss) > 0 { + return &((*hhss)[0]), nil + } + return nil, fmt.Errorf("id %v of hr.holidays.status not found", id) +} + +// GetHrHolidaysStatuss gets hr.holidays.status existing records. +func (c *Client) GetHrHolidaysStatuss(ids []int64) (*HrHolidaysStatuss, error) { + hhss := &HrHolidaysStatuss{} + if err := c.Read(HrHolidaysStatusModel, ids, nil, hhss); err != nil { + return nil, err + } + return hhss, nil +} + +// FindHrHolidaysStatus finds hr.holidays.status record by querying it with criteria. +func (c *Client) FindHrHolidaysStatus(criteria *Criteria) (*HrHolidaysStatus, error) { + hhss := &HrHolidaysStatuss{} + if err := c.SearchRead(HrHolidaysStatusModel, criteria, NewOptions().Limit(1), hhss); err != nil { + return nil, err + } + if hhss != nil && len(*hhss) > 0 { + return &((*hhss)[0]), nil + } + return nil, fmt.Errorf("no hr.holidays.status was found with criteria %v", criteria) +} + +// FindHrHolidaysStatuss finds hr.holidays.status records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrHolidaysStatuss(criteria *Criteria, options *Options) (*HrHolidaysStatuss, error) { + hhss := &HrHolidaysStatuss{} + if err := c.SearchRead(HrHolidaysStatusModel, criteria, options, hhss); err != nil { + return nil, err + } + return hhss, nil +} + +// FindHrHolidaysStatusIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrHolidaysStatusIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(HrHolidaysStatusModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindHrHolidaysStatusId finds record id by querying it with criteria. +func (c *Client) FindHrHolidaysStatusId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrHolidaysStatusModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no hr.holidays.status was found with criteria %v and options %v", criteria, options) +} diff --git a/hr_holidays_summary_dept.go b/hr_holidays_summary_dept.go new file mode 100644 index 00000000..0068e8f3 --- /dev/null +++ b/hr_holidays_summary_dept.go @@ -0,0 +1,121 @@ +package odoo + +import ( + "fmt" +) + +// HrHolidaysSummaryDept represents hr.holidays.summary.dept model. +type HrHolidaysSummaryDept struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DateFrom *Time `xmlrpc:"date_from,omitempty"` + Depts *Relation `xmlrpc:"depts,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + HolidayType *Selection `xmlrpc:"holiday_type,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// HrHolidaysSummaryDepts represents array of hr.holidays.summary.dept model. +type HrHolidaysSummaryDepts []HrHolidaysSummaryDept + +// HrHolidaysSummaryDeptModel is the odoo model name. +const HrHolidaysSummaryDeptModel = "hr.holidays.summary.dept" + +// Many2One convert HrHolidaysSummaryDept to *Many2One. +func (hhsd *HrHolidaysSummaryDept) Many2One() *Many2One { + return NewMany2One(hhsd.Id.Get(), "") +} + +// CreateHrHolidaysSummaryDept creates a new hr.holidays.summary.dept model and returns its id. +func (c *Client) CreateHrHolidaysSummaryDept(hhsd *HrHolidaysSummaryDept) (int64, error) { + return c.Create(HrHolidaysSummaryDeptModel, hhsd) +} + +// UpdateHrHolidaysSummaryDept updates an existing hr.holidays.summary.dept record. +func (c *Client) UpdateHrHolidaysSummaryDept(hhsd *HrHolidaysSummaryDept) error { + return c.UpdateHrHolidaysSummaryDepts([]int64{hhsd.Id.Get()}, hhsd) +} + +// UpdateHrHolidaysSummaryDepts updates existing hr.holidays.summary.dept records. +// All records (represented by ids) will be updated by hhsd values. +func (c *Client) UpdateHrHolidaysSummaryDepts(ids []int64, hhsd *HrHolidaysSummaryDept) error { + return c.Update(HrHolidaysSummaryDeptModel, ids, hhsd) +} + +// DeleteHrHolidaysSummaryDept deletes an existing hr.holidays.summary.dept record. +func (c *Client) DeleteHrHolidaysSummaryDept(id int64) error { + return c.DeleteHrHolidaysSummaryDepts([]int64{id}) +} + +// DeleteHrHolidaysSummaryDepts deletes existing hr.holidays.summary.dept records. +func (c *Client) DeleteHrHolidaysSummaryDepts(ids []int64) error { + return c.Delete(HrHolidaysSummaryDeptModel, ids) +} + +// GetHrHolidaysSummaryDept gets hr.holidays.summary.dept existing record. +func (c *Client) GetHrHolidaysSummaryDept(id int64) (*HrHolidaysSummaryDept, error) { + hhsds, err := c.GetHrHolidaysSummaryDepts([]int64{id}) + if err != nil { + return nil, err + } + if hhsds != nil && len(*hhsds) > 0 { + return &((*hhsds)[0]), nil + } + return nil, fmt.Errorf("id %v of hr.holidays.summary.dept not found", id) +} + +// GetHrHolidaysSummaryDepts gets hr.holidays.summary.dept existing records. +func (c *Client) GetHrHolidaysSummaryDepts(ids []int64) (*HrHolidaysSummaryDepts, error) { + hhsds := &HrHolidaysSummaryDepts{} + if err := c.Read(HrHolidaysSummaryDeptModel, ids, nil, hhsds); err != nil { + return nil, err + } + return hhsds, nil +} + +// FindHrHolidaysSummaryDept finds hr.holidays.summary.dept record by querying it with criteria. +func (c *Client) FindHrHolidaysSummaryDept(criteria *Criteria) (*HrHolidaysSummaryDept, error) { + hhsds := &HrHolidaysSummaryDepts{} + if err := c.SearchRead(HrHolidaysSummaryDeptModel, criteria, NewOptions().Limit(1), hhsds); err != nil { + return nil, err + } + if hhsds != nil && len(*hhsds) > 0 { + return &((*hhsds)[0]), nil + } + return nil, fmt.Errorf("no hr.holidays.summary.dept was found with criteria %v", criteria) +} + +// FindHrHolidaysSummaryDepts finds hr.holidays.summary.dept records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrHolidaysSummaryDepts(criteria *Criteria, options *Options) (*HrHolidaysSummaryDepts, error) { + hhsds := &HrHolidaysSummaryDepts{} + if err := c.SearchRead(HrHolidaysSummaryDeptModel, criteria, options, hhsds); err != nil { + return nil, err + } + return hhsds, nil +} + +// FindHrHolidaysSummaryDeptIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrHolidaysSummaryDeptIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(HrHolidaysSummaryDeptModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindHrHolidaysSummaryDeptId finds record id by querying it with criteria. +func (c *Client) FindHrHolidaysSummaryDeptId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrHolidaysSummaryDeptModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no hr.holidays.summary.dept was found with criteria %v and options %v", criteria, options) +} diff --git a/hr_holidays_summary_employee.go b/hr_holidays_summary_employee.go new file mode 100644 index 00000000..cae37d2c --- /dev/null +++ b/hr_holidays_summary_employee.go @@ -0,0 +1,121 @@ +package odoo + +import ( + "fmt" +) + +// HrHolidaysSummaryEmployee represents hr.holidays.summary.employee model. +type HrHolidaysSummaryEmployee struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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) { + return c.Create(HrHolidaysSummaryEmployeeModel, hhse) +} + +// 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) +} + +// 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 + } + if hhses != nil && len(*hhses) > 0 { + return &((*hhses)[0]), nil + } + return nil, fmt.Errorf("id %v of hr.holidays.summary.employee not found", id) +} + +// 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 + } + if hhses != nil && len(*hhses) > 0 { + return &((*hhses)[0]), nil + } + return nil, fmt.Errorf("no hr.holidays.summary.employee was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(HrHolidaysSummaryEmployeeModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no hr.holidays.summary.employee was found with criteria %v and options %v", criteria, options) +} diff --git a/hr_job.go b/hr_job.go new file mode 100644 index 00000000..6e597bc3 --- /dev/null +++ b/hr_job.go @@ -0,0 +1,140 @@ +package odoo + +import ( + "fmt" +) + +// HrJob represents hr.job model. +type HrJob struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` + Description *String `xmlrpc:"description,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + EmployeeIds *Relation `xmlrpc:"employee_ids,omitempty"` + ExpectedEmployees *Int `xmlrpc:"expected_employees,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + MessageChannelIds *Relation `xmlrpc:"message_channel_ids,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageLastPost *Time `xmlrpc:"message_last_post,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MessageUnread *Bool `xmlrpc:"message_unread,omitempty"` + MessageUnreadCounter *Int `xmlrpc:"message_unread_counter,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + NoOfEmployee *Int `xmlrpc:"no_of_employee,omitempty"` + NoOfHiredEmployee *Int `xmlrpc:"no_of_hired_employee,omitempty"` + NoOfRecruitment *Int `xmlrpc:"no_of_recruitment,omitempty"` + Requirements *String `xmlrpc:"requirements,omitempty"` + State *Selection `xmlrpc:"state,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) { + return c.Create(HrJobModel, hj) +} + +// 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) +} + +// 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 + } + if hjs != nil && len(*hjs) > 0 { + return &((*hjs)[0]), nil + } + return nil, fmt.Errorf("id %v of hr.job not found", id) +} + +// 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 + } + if hjs != nil && len(*hjs) > 0 { + return &((*hjs)[0]), nil + } + return nil, fmt.Errorf("no hr.job was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(HrJobModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no hr.job was found with criteria %v and options %v", criteria, options) +} diff --git a/iap_account.go b/iap_account.go new file mode 100644 index 00000000..82480570 --- /dev/null +++ b/iap_account.go @@ -0,0 +1,121 @@ +package odoo + +import ( + "fmt" +) + +// IapAccount represents iap.account model. +type IapAccount struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AccountToken *String `xmlrpc:"account_token,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"` + ServiceName *String `xmlrpc:"service_name,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) { + return c.Create(IapAccountModel, ia) +} + +// 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) +} + +// 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 + } + if ias != nil && len(*ias) > 0 { + return &((*ias)[0]), nil + } + return nil, fmt.Errorf("id %v of iap.account not found", id) +} + +// 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 + } + if ias != nil && len(*ias) > 0 { + return &((*ias)[0]), nil + } + return nil, fmt.Errorf("no iap.account was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(IapAccountModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no iap.account was found with criteria %v and options %v", criteria, options) +} diff --git a/im_livechat_channel.go b/im_livechat_channel.go new file mode 100644 index 00000000..b56199cd --- /dev/null +++ b/im_livechat_channel.go @@ -0,0 +1,133 @@ +package odoo + +import ( + "fmt" +) + +// ImLivechatChannel represents im_livechat.channel model. +type ImLivechatChannel struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AreYouInside *Bool `xmlrpc:"are_you_inside,omitempty"` + ButtonText *String `xmlrpc:"button_text,omitempty"` + ChannelIds *Relation `xmlrpc:"channel_ids,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DefaultMessage *String `xmlrpc:"default_message,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Image *String `xmlrpc:"image,omitempty"` + ImageMedium *String `xmlrpc:"image_medium,omitempty"` + ImageSmall *String `xmlrpc:"image_small,omitempty"` + InputPlaceholder *String `xmlrpc:"input_placeholder,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + NbrChannel *Int `xmlrpc:"nbr_channel,omitempty"` + RatingPercentageSatisfaction *Int `xmlrpc:"rating_percentage_satisfaction,omitempty"` + RuleIds *Relation `xmlrpc:"rule_ids,omitempty"` + ScriptExternal *String `xmlrpc:"script_external,omitempty"` + UserIds *Relation `xmlrpc:"user_ids,omitempty"` + WebPage *String `xmlrpc:"web_page,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ImLivechatChannels represents array of im_livechat.channel model. +type ImLivechatChannels []ImLivechatChannel + +// ImLivechatChannelModel is the odoo model name. +const ImLivechatChannelModel = "im_livechat.channel" + +// Many2One convert ImLivechatChannel to *Many2One. +func (ic *ImLivechatChannel) Many2One() *Many2One { + return NewMany2One(ic.Id.Get(), "") +} + +// CreateImLivechatChannel creates a new im_livechat.channel model and returns its id. +func (c *Client) CreateImLivechatChannel(ic *ImLivechatChannel) (int64, error) { + return c.Create(ImLivechatChannelModel, ic) +} + +// UpdateImLivechatChannel updates an existing im_livechat.channel record. +func (c *Client) UpdateImLivechatChannel(ic *ImLivechatChannel) error { + return c.UpdateImLivechatChannels([]int64{ic.Id.Get()}, ic) +} + +// UpdateImLivechatChannels updates existing im_livechat.channel records. +// All records (represented by ids) will be updated by ic values. +func (c *Client) UpdateImLivechatChannels(ids []int64, ic *ImLivechatChannel) error { + return c.Update(ImLivechatChannelModel, ids, ic) +} + +// DeleteImLivechatChannel deletes an existing im_livechat.channel record. +func (c *Client) DeleteImLivechatChannel(id int64) error { + return c.DeleteImLivechatChannels([]int64{id}) +} + +// DeleteImLivechatChannels deletes existing im_livechat.channel records. +func (c *Client) DeleteImLivechatChannels(ids []int64) error { + return c.Delete(ImLivechatChannelModel, ids) +} + +// GetImLivechatChannel gets im_livechat.channel existing record. +func (c *Client) GetImLivechatChannel(id int64) (*ImLivechatChannel, error) { + ics, err := c.GetImLivechatChannels([]int64{id}) + if err != nil { + return nil, err + } + if ics != nil && len(*ics) > 0 { + return &((*ics)[0]), nil + } + return nil, fmt.Errorf("id %v of im_livechat.channel not found", id) +} + +// GetImLivechatChannels gets im_livechat.channel existing records. +func (c *Client) GetImLivechatChannels(ids []int64) (*ImLivechatChannels, error) { + ics := &ImLivechatChannels{} + if err := c.Read(ImLivechatChannelModel, ids, nil, ics); err != nil { + return nil, err + } + return ics, nil +} + +// FindImLivechatChannel finds im_livechat.channel record by querying it with criteria. +func (c *Client) FindImLivechatChannel(criteria *Criteria) (*ImLivechatChannel, error) { + ics := &ImLivechatChannels{} + if err := c.SearchRead(ImLivechatChannelModel, criteria, NewOptions().Limit(1), ics); err != nil { + return nil, err + } + if ics != nil && len(*ics) > 0 { + return &((*ics)[0]), nil + } + return nil, fmt.Errorf("no im_livechat.channel was found with criteria %v", criteria) +} + +// FindImLivechatChannels finds im_livechat.channel records by querying it +// and filtering it with criteria and options. +func (c *Client) FindImLivechatChannels(criteria *Criteria, options *Options) (*ImLivechatChannels, error) { + ics := &ImLivechatChannels{} + if err := c.SearchRead(ImLivechatChannelModel, criteria, options, ics); err != nil { + return nil, err + } + return ics, nil +} + +// FindImLivechatChannelIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindImLivechatChannelIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(ImLivechatChannelModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindImLivechatChannelId finds record id by querying it with criteria. +func (c *Client) FindImLivechatChannelId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ImLivechatChannelModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no im_livechat.channel was found with criteria %v and options %v", criteria, options) +} diff --git a/im_livechat_channel_rule.go b/im_livechat_channel_rule.go new file mode 100644 index 00000000..569074be --- /dev/null +++ b/im_livechat_channel_rule.go @@ -0,0 +1,124 @@ +package odoo + +import ( + "fmt" +) + +// ImLivechatChannelRule represents im_livechat.channel.rule model. +type ImLivechatChannelRule struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + Action *Selection `xmlrpc:"action,omitempty"` + AutoPopupTimer *Int `xmlrpc:"auto_popup_timer,omitempty"` + ChannelId *Many2One `xmlrpc:"channel_id,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"` + Id *Int `xmlrpc:"id,omitempty"` + RegexUrl *String `xmlrpc:"regex_url,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ImLivechatChannelRules represents array of im_livechat.channel.rule model. +type ImLivechatChannelRules []ImLivechatChannelRule + +// ImLivechatChannelRuleModel is the odoo model name. +const ImLivechatChannelRuleModel = "im_livechat.channel.rule" + +// Many2One convert ImLivechatChannelRule to *Many2One. +func (icr *ImLivechatChannelRule) Many2One() *Many2One { + return NewMany2One(icr.Id.Get(), "") +} + +// CreateImLivechatChannelRule creates a new im_livechat.channel.rule model and returns its id. +func (c *Client) CreateImLivechatChannelRule(icr *ImLivechatChannelRule) (int64, error) { + return c.Create(ImLivechatChannelRuleModel, icr) +} + +// UpdateImLivechatChannelRule updates an existing im_livechat.channel.rule record. +func (c *Client) UpdateImLivechatChannelRule(icr *ImLivechatChannelRule) error { + return c.UpdateImLivechatChannelRules([]int64{icr.Id.Get()}, icr) +} + +// UpdateImLivechatChannelRules updates existing im_livechat.channel.rule records. +// All records (represented by ids) will be updated by icr values. +func (c *Client) UpdateImLivechatChannelRules(ids []int64, icr *ImLivechatChannelRule) error { + return c.Update(ImLivechatChannelRuleModel, ids, icr) +} + +// DeleteImLivechatChannelRule deletes an existing im_livechat.channel.rule record. +func (c *Client) DeleteImLivechatChannelRule(id int64) error { + return c.DeleteImLivechatChannelRules([]int64{id}) +} + +// DeleteImLivechatChannelRules deletes existing im_livechat.channel.rule records. +func (c *Client) DeleteImLivechatChannelRules(ids []int64) error { + return c.Delete(ImLivechatChannelRuleModel, ids) +} + +// GetImLivechatChannelRule gets im_livechat.channel.rule existing record. +func (c *Client) GetImLivechatChannelRule(id int64) (*ImLivechatChannelRule, error) { + icrs, err := c.GetImLivechatChannelRules([]int64{id}) + if err != nil { + return nil, err + } + if icrs != nil && len(*icrs) > 0 { + return &((*icrs)[0]), nil + } + return nil, fmt.Errorf("id %v of im_livechat.channel.rule not found", id) +} + +// GetImLivechatChannelRules gets im_livechat.channel.rule existing records. +func (c *Client) GetImLivechatChannelRules(ids []int64) (*ImLivechatChannelRules, error) { + icrs := &ImLivechatChannelRules{} + if err := c.Read(ImLivechatChannelRuleModel, ids, nil, icrs); err != nil { + return nil, err + } + return icrs, nil +} + +// FindImLivechatChannelRule finds im_livechat.channel.rule record by querying it with criteria. +func (c *Client) FindImLivechatChannelRule(criteria *Criteria) (*ImLivechatChannelRule, error) { + icrs := &ImLivechatChannelRules{} + if err := c.SearchRead(ImLivechatChannelRuleModel, criteria, NewOptions().Limit(1), icrs); err != nil { + return nil, err + } + if icrs != nil && len(*icrs) > 0 { + return &((*icrs)[0]), nil + } + return nil, fmt.Errorf("no im_livechat.channel.rule was found with criteria %v", criteria) +} + +// FindImLivechatChannelRules finds im_livechat.channel.rule records by querying it +// and filtering it with criteria and options. +func (c *Client) FindImLivechatChannelRules(criteria *Criteria, options *Options) (*ImLivechatChannelRules, error) { + icrs := &ImLivechatChannelRules{} + if err := c.SearchRead(ImLivechatChannelRuleModel, criteria, options, icrs); err != nil { + return nil, err + } + return icrs, nil +} + +// FindImLivechatChannelRuleIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindImLivechatChannelRuleIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(ImLivechatChannelRuleModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindImLivechatChannelRuleId finds record id by querying it with criteria. +func (c *Client) FindImLivechatChannelRuleId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ImLivechatChannelRuleModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no im_livechat.channel.rule was found with criteria %v and options %v", criteria, options) +} diff --git a/im_livechat_report_channel.go b/im_livechat_report_channel.go new file mode 100644 index 00000000..0afd06d7 --- /dev/null +++ b/im_livechat_report_channel.go @@ -0,0 +1,125 @@ +package odoo + +import ( + "fmt" +) + +// ImLivechatReportChannel represents im_livechat.report.channel model. +type ImLivechatReportChannel struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + ChannelId *Many2One `xmlrpc:"channel_id,omitempty"` + ChannelName *String `xmlrpc:"channel_name,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Duration *Float `xmlrpc:"duration,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LivechatChannelId *Many2One `xmlrpc:"livechat_channel_id,omitempty"` + NbrMessage *Int `xmlrpc:"nbr_message,omitempty"` + NbrSpeaker *Int `xmlrpc:"nbr_speaker,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + StartDate *Time `xmlrpc:"start_date,omitempty"` + StartDateHour *String `xmlrpc:"start_date_hour,omitempty"` + TechnicalName *String `xmlrpc:"technical_name,omitempty"` + Uuid *String `xmlrpc:"uuid,omitempty"` +} + +// ImLivechatReportChannels represents array of im_livechat.report.channel model. +type ImLivechatReportChannels []ImLivechatReportChannel + +// ImLivechatReportChannelModel is the odoo model name. +const ImLivechatReportChannelModel = "im_livechat.report.channel" + +// Many2One convert ImLivechatReportChannel to *Many2One. +func (irc *ImLivechatReportChannel) Many2One() *Many2One { + return NewMany2One(irc.Id.Get(), "") +} + +// CreateImLivechatReportChannel creates a new im_livechat.report.channel model and returns its id. +func (c *Client) CreateImLivechatReportChannel(irc *ImLivechatReportChannel) (int64, error) { + return c.Create(ImLivechatReportChannelModel, irc) +} + +// UpdateImLivechatReportChannel updates an existing im_livechat.report.channel record. +func (c *Client) UpdateImLivechatReportChannel(irc *ImLivechatReportChannel) error { + return c.UpdateImLivechatReportChannels([]int64{irc.Id.Get()}, irc) +} + +// UpdateImLivechatReportChannels updates existing im_livechat.report.channel records. +// All records (represented by ids) will be updated by irc values. +func (c *Client) UpdateImLivechatReportChannels(ids []int64, irc *ImLivechatReportChannel) error { + return c.Update(ImLivechatReportChannelModel, ids, irc) +} + +// DeleteImLivechatReportChannel deletes an existing im_livechat.report.channel record. +func (c *Client) DeleteImLivechatReportChannel(id int64) error { + return c.DeleteImLivechatReportChannels([]int64{id}) +} + +// DeleteImLivechatReportChannels deletes existing im_livechat.report.channel records. +func (c *Client) DeleteImLivechatReportChannels(ids []int64) error { + return c.Delete(ImLivechatReportChannelModel, ids) +} + +// GetImLivechatReportChannel gets im_livechat.report.channel existing record. +func (c *Client) GetImLivechatReportChannel(id int64) (*ImLivechatReportChannel, error) { + ircs, err := c.GetImLivechatReportChannels([]int64{id}) + if err != nil { + return nil, err + } + if ircs != nil && len(*ircs) > 0 { + return &((*ircs)[0]), nil + } + return nil, fmt.Errorf("id %v of im_livechat.report.channel not found", id) +} + +// GetImLivechatReportChannels gets im_livechat.report.channel existing records. +func (c *Client) GetImLivechatReportChannels(ids []int64) (*ImLivechatReportChannels, error) { + ircs := &ImLivechatReportChannels{} + if err := c.Read(ImLivechatReportChannelModel, ids, nil, ircs); err != nil { + return nil, err + } + return ircs, nil +} + +// FindImLivechatReportChannel finds im_livechat.report.channel record by querying it with criteria. +func (c *Client) FindImLivechatReportChannel(criteria *Criteria) (*ImLivechatReportChannel, error) { + ircs := &ImLivechatReportChannels{} + if err := c.SearchRead(ImLivechatReportChannelModel, criteria, NewOptions().Limit(1), ircs); err != nil { + return nil, err + } + if ircs != nil && len(*ircs) > 0 { + return &((*ircs)[0]), nil + } + return nil, fmt.Errorf("no im_livechat.report.channel was found with criteria %v", criteria) +} + +// FindImLivechatReportChannels finds im_livechat.report.channel records by querying it +// and filtering it with criteria and options. +func (c *Client) FindImLivechatReportChannels(criteria *Criteria, options *Options) (*ImLivechatReportChannels, error) { + ircs := &ImLivechatReportChannels{} + if err := c.SearchRead(ImLivechatReportChannelModel, criteria, options, ircs); err != nil { + return nil, err + } + return ircs, nil +} + +// FindImLivechatReportChannelIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindImLivechatReportChannelIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(ImLivechatReportChannelModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindImLivechatReportChannelId finds record id by querying it with criteria. +func (c *Client) FindImLivechatReportChannelId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ImLivechatReportChannelModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no im_livechat.report.channel was found with criteria %v and options %v", criteria, options) +} diff --git a/im_livechat_report_operator.go b/im_livechat_report_operator.go new file mode 100644 index 00000000..c6a81dd0 --- /dev/null +++ b/im_livechat_report_operator.go @@ -0,0 +1,121 @@ +package odoo + +import ( + "fmt" +) + +// ImLivechatReportOperator represents im_livechat.report.operator model. +type ImLivechatReportOperator struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + ChannelId *Many2One `xmlrpc:"channel_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Duration *Float `xmlrpc:"duration,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LivechatChannelId *Many2One `xmlrpc:"livechat_channel_id,omitempty"` + NbrChannel *Int `xmlrpc:"nbr_channel,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + StartDate *Time `xmlrpc:"start_date,omitempty"` + TimeToAnswer *Float `xmlrpc:"time_to_answer,omitempty"` +} + +// ImLivechatReportOperators represents array of im_livechat.report.operator model. +type ImLivechatReportOperators []ImLivechatReportOperator + +// ImLivechatReportOperatorModel is the odoo model name. +const ImLivechatReportOperatorModel = "im_livechat.report.operator" + +// Many2One convert ImLivechatReportOperator to *Many2One. +func (iro *ImLivechatReportOperator) Many2One() *Many2One { + return NewMany2One(iro.Id.Get(), "") +} + +// CreateImLivechatReportOperator creates a new im_livechat.report.operator model and returns its id. +func (c *Client) CreateImLivechatReportOperator(iro *ImLivechatReportOperator) (int64, error) { + return c.Create(ImLivechatReportOperatorModel, iro) +} + +// UpdateImLivechatReportOperator updates an existing im_livechat.report.operator record. +func (c *Client) UpdateImLivechatReportOperator(iro *ImLivechatReportOperator) error { + return c.UpdateImLivechatReportOperators([]int64{iro.Id.Get()}, iro) +} + +// UpdateImLivechatReportOperators updates existing im_livechat.report.operator records. +// All records (represented by ids) will be updated by iro values. +func (c *Client) UpdateImLivechatReportOperators(ids []int64, iro *ImLivechatReportOperator) error { + return c.Update(ImLivechatReportOperatorModel, ids, iro) +} + +// DeleteImLivechatReportOperator deletes an existing im_livechat.report.operator record. +func (c *Client) DeleteImLivechatReportOperator(id int64) error { + return c.DeleteImLivechatReportOperators([]int64{id}) +} + +// DeleteImLivechatReportOperators deletes existing im_livechat.report.operator records. +func (c *Client) DeleteImLivechatReportOperators(ids []int64) error { + return c.Delete(ImLivechatReportOperatorModel, ids) +} + +// GetImLivechatReportOperator gets im_livechat.report.operator existing record. +func (c *Client) GetImLivechatReportOperator(id int64) (*ImLivechatReportOperator, error) { + iros, err := c.GetImLivechatReportOperators([]int64{id}) + if err != nil { + return nil, err + } + if iros != nil && len(*iros) > 0 { + return &((*iros)[0]), nil + } + return nil, fmt.Errorf("id %v of im_livechat.report.operator not found", id) +} + +// GetImLivechatReportOperators gets im_livechat.report.operator existing records. +func (c *Client) GetImLivechatReportOperators(ids []int64) (*ImLivechatReportOperators, error) { + iros := &ImLivechatReportOperators{} + if err := c.Read(ImLivechatReportOperatorModel, ids, nil, iros); err != nil { + return nil, err + } + return iros, nil +} + +// FindImLivechatReportOperator finds im_livechat.report.operator record by querying it with criteria. +func (c *Client) FindImLivechatReportOperator(criteria *Criteria) (*ImLivechatReportOperator, error) { + iros := &ImLivechatReportOperators{} + if err := c.SearchRead(ImLivechatReportOperatorModel, criteria, NewOptions().Limit(1), iros); err != nil { + return nil, err + } + if iros != nil && len(*iros) > 0 { + return &((*iros)[0]), nil + } + return nil, fmt.Errorf("no im_livechat.report.operator was found with criteria %v", criteria) +} + +// FindImLivechatReportOperators finds im_livechat.report.operator records by querying it +// and filtering it with criteria and options. +func (c *Client) FindImLivechatReportOperators(criteria *Criteria, options *Options) (*ImLivechatReportOperators, error) { + iros := &ImLivechatReportOperators{} + if err := c.SearchRead(ImLivechatReportOperatorModel, criteria, options, iros); err != nil { + return nil, err + } + return iros, nil +} + +// FindImLivechatReportOperatorIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindImLivechatReportOperatorIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(ImLivechatReportOperatorModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindImLivechatReportOperatorId finds record id by querying it with criteria. +func (c *Client) FindImLivechatReportOperatorId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ImLivechatReportOperatorModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no im_livechat.report.operator was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_actions_act_url.go b/ir_actions_act_url.go new file mode 100644 index 00000000..d2b85989 --- /dev/null +++ b/ir_actions_act_url.go @@ -0,0 +1,126 @@ +package odoo + +import ( + "fmt" +) + +// IrActionsActUrl represents ir.actions.act_url model. +type IrActionsActUrl struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + BindingModelId *Many2One `xmlrpc:"binding_model_id,omitempty"` + BindingType *Selection `xmlrpc:"binding_type,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"` + 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) { + return c.Create(IrActionsActUrlModel, iaa) +} + +// 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) +} + +// 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 + } + if iaas != nil && len(*iaas) > 0 { + return &((*iaas)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.actions.act_url not found", id) +} + +// 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 + } + if iaas != nil && len(*iaas) > 0 { + return &((*iaas)[0]), nil + } + return nil, fmt.Errorf("no ir.actions.act_url was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(IrActionsActUrlModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.actions.act_url was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_actions_act_window.go b/ir_actions_act_window.go new file mode 100644 index 00000000..f8d3927f --- /dev/null +++ b/ir_actions_act_window.go @@ -0,0 +1,143 @@ +package odoo + +import ( + "fmt" +) + +// IrActionsActWindow represents ir.actions.act_window model. +type IrActionsActWindow struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AutoSearch *Bool `xmlrpc:"auto_search,omitempty"` + BindingModelId *Many2One `xmlrpc:"binding_model_id,omitempty"` + BindingType *Selection `xmlrpc:"binding_type,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"` + 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"` + Multi *Bool `xmlrpc:"multi,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + ResId *Int `xmlrpc:"res_id,omitempty"` + ResModel *String `xmlrpc:"res_model,omitempty"` + SearchView *String `xmlrpc:"search_view,omitempty"` + SearchViewId *Many2One `xmlrpc:"search_view_id,omitempty"` + SrcModel *String `xmlrpc:"src_model,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"` + ViewType *Selection `xmlrpc:"view_type,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) { + return c.Create(IrActionsActWindowModel, iaa) +} + +// 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) +} + +// 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 + } + if iaas != nil && len(*iaas) > 0 { + return &((*iaas)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.actions.act_window not found", id) +} + +// 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 + } + if iaas != nil && len(*iaas) > 0 { + return &((*iaas)[0]), nil + } + return nil, fmt.Errorf("no ir.actions.act_window was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(IrActionsActWindowModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.actions.act_window was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_actions_act_window_close.go b/ir_actions_act_window_close.go new file mode 100644 index 00000000..8e86c938 --- /dev/null +++ b/ir_actions_act_window_close.go @@ -0,0 +1,124 @@ +package odoo + +import ( + "fmt" +) + +// IrActionsActWindowClose represents ir.actions.act_window_close model. +type IrActionsActWindowClose struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + BindingModelId *Many2One `xmlrpc:"binding_model_id,omitempty"` + BindingType *Selection `xmlrpc:"binding_type,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"` + 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) { + return c.Create(IrActionsActWindowCloseModel, iaa) +} + +// 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) +} + +// 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 + } + if iaas != nil && len(*iaas) > 0 { + return &((*iaas)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.actions.act_window_close not found", id) +} + +// 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 + } + if iaas != nil && len(*iaas) > 0 { + return &((*iaas)[0]), nil + } + return nil, fmt.Errorf("no ir.actions.act_window_close was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(IrActionsActWindowCloseModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.actions.act_window_close was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_actions_act_window_view.go b/ir_actions_act_window_view.go new file mode 100644 index 00000000..4a8660a9 --- /dev/null +++ b/ir_actions_act_window_view.go @@ -0,0 +1,123 @@ +package odoo + +import ( + "fmt" +) + +// IrActionsActWindowView represents ir.actions.act_window.view model. +type IrActionsActWindowView struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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) { + return c.Create(IrActionsActWindowViewModel, iaav) +} + +// 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) +} + +// 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 + } + if iaavs != nil && len(*iaavs) > 0 { + return &((*iaavs)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.actions.act_window.view not found", id) +} + +// 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 + } + if iaavs != nil && len(*iaavs) > 0 { + return &((*iaavs)[0]), nil + } + return nil, fmt.Errorf("no ir.actions.act_window.view was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(IrActionsActWindowViewModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.actions.act_window.view was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_actions_actions.go b/ir_actions_actions.go new file mode 100644 index 00000000..ee789c87 --- /dev/null +++ b/ir_actions_actions.go @@ -0,0 +1,124 @@ +package odoo + +import ( + "fmt" +) + +// IrActionsActions represents ir.actions.actions model. +type IrActionsActions struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + BindingModelId *Many2One `xmlrpc:"binding_model_id,omitempty"` + BindingType *Selection `xmlrpc:"binding_type,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"` + 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) { + return c.Create(IrActionsActionsModel, iaa) +} + +// 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) +} + +// 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 + } + if iaas != nil && len(*iaas) > 0 { + return &((*iaas)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.actions.actions not found", id) +} + +// 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 + } + if iaas != nil && len(*iaas) > 0 { + return &((*iaas)[0]), nil + } + return nil, fmt.Errorf("no ir.actions.actions was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(IrActionsActionsModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.actions.actions was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_actions_client.go b/ir_actions_client.go new file mode 100644 index 00000000..5bc6d677 --- /dev/null +++ b/ir_actions_client.go @@ -0,0 +1,130 @@ +package odoo + +import ( + "fmt" +) + +// IrActionsClient represents ir.actions.client model. +type IrActionsClient struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + BindingModelId *Many2One `xmlrpc:"binding_model_id,omitempty"` + BindingType *Selection `xmlrpc:"binding_type,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"` + 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) { + return c.Create(IrActionsClientModel, iac) +} + +// 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) +} + +// 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 + } + if iacs != nil && len(*iacs) > 0 { + return &((*iacs)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.actions.client not found", id) +} + +// 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 + } + if iacs != nil && len(*iacs) > 0 { + return &((*iacs)[0]), nil + } + return nil, fmt.Errorf("no ir.actions.client was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(IrActionsClientModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.actions.client was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_actions_report.go b/ir_actions_report.go new file mode 100644 index 00000000..0df52e3b --- /dev/null +++ b/ir_actions_report.go @@ -0,0 +1,134 @@ +package odoo + +import ( + "fmt" +) + +// IrActionsReport represents ir.actions.report model. +type IrActionsReport struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + Attachment *String `xmlrpc:"attachment,omitempty"` + AttachmentUse *Bool `xmlrpc:"attachment_use,omitempty"` + BindingModelId *Many2One `xmlrpc:"binding_model_id,omitempty"` + BindingType *Selection `xmlrpc:"binding_type,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"` + Help *String `xmlrpc:"help,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Model *String `xmlrpc:"model,omitempty"` + Multi *Bool `xmlrpc:"multi,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + PaperformatId *Many2One `xmlrpc:"paperformat_id,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) { + return c.Create(IrActionsReportModel, iar) +} + +// 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) +} + +// 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 + } + if iars != nil && len(*iars) > 0 { + return &((*iars)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.actions.report not found", id) +} + +// 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 + } + if iars != nil && len(*iars) > 0 { + return &((*iars)[0]), nil + } + return nil, fmt.Errorf("no ir.actions.report was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(IrActionsReportModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.actions.report was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_actions_server.go b/ir_actions_server.go new file mode 100644 index 00000000..a56ba242 --- /dev/null +++ b/ir_actions_server.go @@ -0,0 +1,138 @@ +package odoo + +import ( + "fmt" +) + +// IrActionsServer represents ir.actions.server model. +type IrActionsServer struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + BindingModelId *Many2One `xmlrpc:"binding_model_id,omitempty"` + BindingType *Selection `xmlrpc:"binding_type,omitempty"` + ChannelIds *Relation `xmlrpc:"channel_ids,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"` + FieldsLines *Relation `xmlrpc:"fields_lines,omitempty"` + Help *String `xmlrpc:"help,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LinkFieldId *Many2One `xmlrpc:"link_field_id,omitempty"` + ModelId *Many2One `xmlrpc:"model_id,omitempty"` + ModelName *String `xmlrpc:"model_name,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + PartnerIds *Relation `xmlrpc:"partner_ids,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + TemplateId *Many2One `xmlrpc:"template_id,omitempty"` + Type *String `xmlrpc:"type,omitempty"` + Usage *Selection `xmlrpc:"usage,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) { + return c.Create(IrActionsServerModel, ias) +} + +// 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) +} + +// 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 + } + if iass != nil && len(*iass) > 0 { + return &((*iass)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.actions.server not found", id) +} + +// 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 + } + if iass != nil && len(*iass) > 0 { + return &((*iass)[0]), nil + } + return nil, fmt.Errorf("no ir.actions.server was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(IrActionsServerModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.actions.server was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_actions_todo.go b/ir_actions_todo.go new file mode 100644 index 00000000..93e3f52e --- /dev/null +++ b/ir_actions_todo.go @@ -0,0 +1,122 @@ +package odoo + +import ( + "fmt" +) + +// IrActionsTodo represents ir.actions.todo model. +type IrActionsTodo struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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) { + return c.Create(IrActionsTodoModel, iat) +} + +// 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) +} + +// 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 + } + if iats != nil && len(*iats) > 0 { + return &((*iats)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.actions.todo not found", id) +} + +// 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 + } + if iats != nil && len(*iats) > 0 { + return &((*iats)[0]), nil + } + return nil, fmt.Errorf("no ir.actions.todo was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(IrActionsTodoModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.actions.todo was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_attachment.go b/ir_attachment.go new file mode 100644 index 00000000..2982fd8b --- /dev/null +++ b/ir_attachment.go @@ -0,0 +1,138 @@ +package odoo + +import ( + "fmt" +) + +// IrAttachment represents ir.attachment model. +type IrAttachment struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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"` + DatasFname *String `xmlrpc:"datas_fname,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"` + IndexContent *String `xmlrpc:"index_content,omitempty"` + LocalUrl *String `xmlrpc:"local_url,omitempty"` + Mimetype *String `xmlrpc:"mimetype,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Public *Bool `xmlrpc:"public,omitempty"` + ResField *String `xmlrpc:"res_field,omitempty"` + ResId *Int `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"` + 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) { + return c.Create(IrAttachmentModel, ia) +} + +// 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) +} + +// 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 + } + if ias != nil && len(*ias) > 0 { + return &((*ias)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.attachment not found", id) +} + +// 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 + } + if ias != nil && len(*ias) > 0 { + return &((*ias)[0]), nil + } + return nil, fmt.Errorf("no ir.attachment was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(IrAttachmentModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.attachment was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_autovacuum.go b/ir_autovacuum.go new file mode 100644 index 00000000..5713b59b --- /dev/null +++ b/ir_autovacuum.go @@ -0,0 +1,114 @@ +package odoo + +import ( + "fmt" +) + +// IrAutovacuum represents ir.autovacuum model. +type IrAutovacuum struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` +} + +// IrAutovacuums represents array of ir.autovacuum model. +type IrAutovacuums []IrAutovacuum + +// IrAutovacuumModel is the odoo model name. +const IrAutovacuumModel = "ir.autovacuum" + +// Many2One convert IrAutovacuum to *Many2One. +func (ia *IrAutovacuum) Many2One() *Many2One { + return NewMany2One(ia.Id.Get(), "") +} + +// CreateIrAutovacuum creates a new ir.autovacuum model and returns its id. +func (c *Client) CreateIrAutovacuum(ia *IrAutovacuum) (int64, error) { + return c.Create(IrAutovacuumModel, ia) +} + +// UpdateIrAutovacuum updates an existing ir.autovacuum record. +func (c *Client) UpdateIrAutovacuum(ia *IrAutovacuum) error { + return c.UpdateIrAutovacuums([]int64{ia.Id.Get()}, ia) +} + +// UpdateIrAutovacuums updates existing ir.autovacuum records. +// All records (represented by ids) will be updated by ia values. +func (c *Client) UpdateIrAutovacuums(ids []int64, ia *IrAutovacuum) error { + return c.Update(IrAutovacuumModel, ids, ia) +} + +// DeleteIrAutovacuum deletes an existing ir.autovacuum record. +func (c *Client) DeleteIrAutovacuum(id int64) error { + return c.DeleteIrAutovacuums([]int64{id}) +} + +// DeleteIrAutovacuums deletes existing ir.autovacuum records. +func (c *Client) DeleteIrAutovacuums(ids []int64) error { + return c.Delete(IrAutovacuumModel, ids) +} + +// GetIrAutovacuum gets ir.autovacuum existing record. +func (c *Client) GetIrAutovacuum(id int64) (*IrAutovacuum, error) { + ias, err := c.GetIrAutovacuums([]int64{id}) + if err != nil { + return nil, err + } + if ias != nil && len(*ias) > 0 { + return &((*ias)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.autovacuum not found", id) +} + +// GetIrAutovacuums gets ir.autovacuum existing records. +func (c *Client) GetIrAutovacuums(ids []int64) (*IrAutovacuums, error) { + ias := &IrAutovacuums{} + if err := c.Read(IrAutovacuumModel, ids, nil, ias); err != nil { + return nil, err + } + return ias, nil +} + +// FindIrAutovacuum finds ir.autovacuum record by querying it with criteria. +func (c *Client) FindIrAutovacuum(criteria *Criteria) (*IrAutovacuum, error) { + ias := &IrAutovacuums{} + if err := c.SearchRead(IrAutovacuumModel, criteria, NewOptions().Limit(1), ias); err != nil { + return nil, err + } + if ias != nil && len(*ias) > 0 { + return &((*ias)[0]), nil + } + return nil, fmt.Errorf("no ir.autovacuum was found with criteria %v", criteria) +} + +// FindIrAutovacuums finds ir.autovacuum records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrAutovacuums(criteria *Criteria, options *Options) (*IrAutovacuums, error) { + ias := &IrAutovacuums{} + if err := c.SearchRead(IrAutovacuumModel, criteria, options, ias); err != nil { + return nil, err + } + return ias, nil +} + +// FindIrAutovacuumIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrAutovacuumIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(IrAutovacuumModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindIrAutovacuumId finds record id by querying it with criteria. +func (c *Client) FindIrAutovacuumId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrAutovacuumModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.autovacuum was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_config_parameter.go b/ir_config_parameter.go new file mode 100644 index 00000000..c7636705 --- /dev/null +++ b/ir_config_parameter.go @@ -0,0 +1,120 @@ +package odoo + +import ( + "fmt" +) + +// IrConfigParameter represents ir.config_parameter model. +type IrConfigParameter struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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) { + return c.Create(IrConfigParameterModel, ic) +} + +// 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) +} + +// 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 + } + if ics != nil && len(*ics) > 0 { + return &((*ics)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.config_parameter not found", id) +} + +// 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 + } + if ics != nil && len(*ics) > 0 { + return &((*ics)[0]), nil + } + return nil, fmt.Errorf("no ir.config_parameter was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(IrConfigParameterModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.config_parameter was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_cron.go b/ir_cron.go new file mode 100644 index 00000000..5319c0cf --- /dev/null +++ b/ir_cron.go @@ -0,0 +1,148 @@ +package odoo + +import ( + "fmt" +) + +// IrCron represents ir.cron model. +type IrCron struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + Active *Bool `xmlrpc:"active,omitempty"` + BindingModelId *Many2One `xmlrpc:"binding_model_id,omitempty"` + BindingType *Selection `xmlrpc:"binding_type,omitempty"` + ChannelIds *Relation `xmlrpc:"channel_ids,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"` + Doall *Bool `xmlrpc:"doall,omitempty"` + FieldsLines *Relation `xmlrpc:"fields_lines,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"` + LinkFieldId *Many2One `xmlrpc:"link_field_id,omitempty"` + ModelId *Many2One `xmlrpc:"model_id,omitempty"` + ModelName *String `xmlrpc:"model_name,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Nextcall *Time `xmlrpc:"nextcall,omitempty"` + Numbercall *Int `xmlrpc:"numbercall,omitempty"` + PartnerIds *Relation `xmlrpc:"partner_ids,omitempty"` + Priority *Int `xmlrpc:"priority,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + TemplateId *Many2One `xmlrpc:"template_id,omitempty"` + Type *String `xmlrpc:"type,omitempty"` + Usage *Selection `xmlrpc:"usage,omitempty"` + UserId *Many2One `xmlrpc:"user_id,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) { + return c.Create(IrCronModel, ic) +} + +// 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) +} + +// 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 + } + if ics != nil && len(*ics) > 0 { + return &((*ics)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.cron not found", id) +} + +// 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 + } + if ics != nil && len(*ics) > 0 { + return &((*ics)[0]), nil + } + return nil, fmt.Errorf("no ir.cron was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(IrCronModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.cron was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_default.go b/ir_default.go new file mode 100644 index 00000000..8c765b55 --- /dev/null +++ b/ir_default.go @@ -0,0 +1,123 @@ +package odoo + +import ( + "fmt" +) + +// IrDefault represents ir.default model. +type IrDefault struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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) { + return c.Create(IrDefaultModel, ID) +} + +// 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) +} + +// 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 + } + if IDs != nil && len(*IDs) > 0 { + return &((*IDs)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.default not found", id) +} + +// 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 + } + if IDs != nil && len(*IDs) > 0 { + return &((*IDs)[0]), nil + } + return nil, fmt.Errorf("no ir.default was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(IrDefaultModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.default was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_exports.go b/ir_exports.go new file mode 100644 index 00000000..e6552d80 --- /dev/null +++ b/ir_exports.go @@ -0,0 +1,121 @@ +package odoo + +import ( + "fmt" +) + +// IrExports represents ir.exports model. +type IrExports struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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) { + return c.Create(IrExportsModel, ie) +} + +// 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) +} + +// 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 + } + if ies != nil && len(*ies) > 0 { + return &((*ies)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.exports not found", id) +} + +// 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 + } + if ies != nil && len(*ies) > 0 { + return &((*ies)[0]), nil + } + return nil, fmt.Errorf("no ir.exports was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(IrExportsModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.exports was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_exports_line.go b/ir_exports_line.go new file mode 100644 index 00000000..2f8995eb --- /dev/null +++ b/ir_exports_line.go @@ -0,0 +1,120 @@ +package odoo + +import ( + "fmt" +) + +// IrExportsLine represents ir.exports.line model. +type IrExportsLine struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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) { + return c.Create(IrExportsLineModel, iel) +} + +// 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) +} + +// 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 + } + if iels != nil && len(*iels) > 0 { + return &((*iels)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.exports.line not found", id) +} + +// 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 + } + if iels != nil && len(*iels) > 0 { + return &((*iels)[0]), nil + } + return nil, fmt.Errorf("no ir.exports.line was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(IrExportsLineModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.exports.line was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_fields_converter.go b/ir_fields_converter.go new file mode 100644 index 00000000..a1a4569e --- /dev/null +++ b/ir_fields_converter.go @@ -0,0 +1,114 @@ +package odoo + +import ( + "fmt" +) + +// IrFieldsConverter represents ir.fields.converter model. +type IrFieldsConverter struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` +} + +// IrFieldsConverters represents array of ir.fields.converter model. +type IrFieldsConverters []IrFieldsConverter + +// IrFieldsConverterModel is the odoo model name. +const IrFieldsConverterModel = "ir.fields.converter" + +// Many2One convert IrFieldsConverter to *Many2One. +func (ifc *IrFieldsConverter) Many2One() *Many2One { + return NewMany2One(ifc.Id.Get(), "") +} + +// CreateIrFieldsConverter creates a new ir.fields.converter model and returns its id. +func (c *Client) CreateIrFieldsConverter(ifc *IrFieldsConverter) (int64, error) { + return c.Create(IrFieldsConverterModel, ifc) +} + +// UpdateIrFieldsConverter updates an existing ir.fields.converter record. +func (c *Client) UpdateIrFieldsConverter(ifc *IrFieldsConverter) error { + return c.UpdateIrFieldsConverters([]int64{ifc.Id.Get()}, ifc) +} + +// UpdateIrFieldsConverters updates existing ir.fields.converter records. +// All records (represented by ids) will be updated by ifc values. +func (c *Client) UpdateIrFieldsConverters(ids []int64, ifc *IrFieldsConverter) error { + return c.Update(IrFieldsConverterModel, ids, ifc) +} + +// DeleteIrFieldsConverter deletes an existing ir.fields.converter record. +func (c *Client) DeleteIrFieldsConverter(id int64) error { + return c.DeleteIrFieldsConverters([]int64{id}) +} + +// DeleteIrFieldsConverters deletes existing ir.fields.converter records. +func (c *Client) DeleteIrFieldsConverters(ids []int64) error { + return c.Delete(IrFieldsConverterModel, ids) +} + +// GetIrFieldsConverter gets ir.fields.converter existing record. +func (c *Client) GetIrFieldsConverter(id int64) (*IrFieldsConverter, error) { + ifcs, err := c.GetIrFieldsConverters([]int64{id}) + if err != nil { + return nil, err + } + if ifcs != nil && len(*ifcs) > 0 { + return &((*ifcs)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.fields.converter not found", id) +} + +// GetIrFieldsConverters gets ir.fields.converter existing records. +func (c *Client) GetIrFieldsConverters(ids []int64) (*IrFieldsConverters, error) { + ifcs := &IrFieldsConverters{} + if err := c.Read(IrFieldsConverterModel, ids, nil, ifcs); err != nil { + return nil, err + } + return ifcs, nil +} + +// FindIrFieldsConverter finds ir.fields.converter record by querying it with criteria. +func (c *Client) FindIrFieldsConverter(criteria *Criteria) (*IrFieldsConverter, error) { + ifcs := &IrFieldsConverters{} + if err := c.SearchRead(IrFieldsConverterModel, criteria, NewOptions().Limit(1), ifcs); err != nil { + return nil, err + } + if ifcs != nil && len(*ifcs) > 0 { + return &((*ifcs)[0]), nil + } + return nil, fmt.Errorf("no ir.fields.converter was found with criteria %v", criteria) +} + +// FindIrFieldsConverters finds ir.fields.converter records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrFieldsConverters(criteria *Criteria, options *Options) (*IrFieldsConverters, error) { + ifcs := &IrFieldsConverters{} + if err := c.SearchRead(IrFieldsConverterModel, criteria, options, ifcs); err != nil { + return nil, err + } + return ifcs, nil +} + +// FindIrFieldsConverterIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrFieldsConverterIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(IrFieldsConverterModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindIrFieldsConverterId finds record id by querying it with criteria. +func (c *Client) FindIrFieldsConverterId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrFieldsConverterModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.fields.converter was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_filters.go b/ir_filters.go new file mode 100644 index 00000000..a529b038 --- /dev/null +++ b/ir_filters.go @@ -0,0 +1,127 @@ +package odoo + +import ( + "fmt" +) + +// IrFilters represents ir.filters model. +type IrFilters struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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"` + 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) { + return c.Create(IrFiltersModel, IF) +} + +// 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) +} + +// 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 + } + if IFs != nil && len(*IFs) > 0 { + return &((*IFs)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.filters not found", id) +} + +// 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 + } + if IFs != nil && len(*IFs) > 0 { + return &((*IFs)[0]), nil + } + return nil, fmt.Errorf("no ir.filters was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(IrFiltersModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.filters was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_http.go b/ir_http.go new file mode 100644 index 00000000..d9e2af75 --- /dev/null +++ b/ir_http.go @@ -0,0 +1,114 @@ +package odoo + +import ( + "fmt" +) + +// IrHttp represents ir.http model. +type IrHttp struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` +} + +// IrHttps represents array of ir.http model. +type IrHttps []IrHttp + +// IrHttpModel is the odoo model name. +const IrHttpModel = "ir.http" + +// Many2One convert IrHttp to *Many2One. +func (ih *IrHttp) Many2One() *Many2One { + return NewMany2One(ih.Id.Get(), "") +} + +// CreateIrHttp creates a new ir.http model and returns its id. +func (c *Client) CreateIrHttp(ih *IrHttp) (int64, error) { + return c.Create(IrHttpModel, ih) +} + +// UpdateIrHttp updates an existing ir.http record. +func (c *Client) UpdateIrHttp(ih *IrHttp) error { + return c.UpdateIrHttps([]int64{ih.Id.Get()}, ih) +} + +// UpdateIrHttps updates existing ir.http records. +// All records (represented by ids) will be updated by ih values. +func (c *Client) UpdateIrHttps(ids []int64, ih *IrHttp) error { + return c.Update(IrHttpModel, ids, ih) +} + +// DeleteIrHttp deletes an existing ir.http record. +func (c *Client) DeleteIrHttp(id int64) error { + return c.DeleteIrHttps([]int64{id}) +} + +// DeleteIrHttps deletes existing ir.http records. +func (c *Client) DeleteIrHttps(ids []int64) error { + return c.Delete(IrHttpModel, ids) +} + +// GetIrHttp gets ir.http existing record. +func (c *Client) GetIrHttp(id int64) (*IrHttp, error) { + ihs, err := c.GetIrHttps([]int64{id}) + if err != nil { + return nil, err + } + if ihs != nil && len(*ihs) > 0 { + return &((*ihs)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.http not found", id) +} + +// GetIrHttps gets ir.http existing records. +func (c *Client) GetIrHttps(ids []int64) (*IrHttps, error) { + ihs := &IrHttps{} + if err := c.Read(IrHttpModel, ids, nil, ihs); err != nil { + return nil, err + } + return ihs, nil +} + +// FindIrHttp finds ir.http record by querying it with criteria. +func (c *Client) FindIrHttp(criteria *Criteria) (*IrHttp, error) { + ihs := &IrHttps{} + if err := c.SearchRead(IrHttpModel, criteria, NewOptions().Limit(1), ihs); err != nil { + return nil, err + } + if ihs != nil && len(*ihs) > 0 { + return &((*ihs)[0]), nil + } + return nil, fmt.Errorf("no ir.http was found with criteria %v", criteria) +} + +// FindIrHttps finds ir.http records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrHttps(criteria *Criteria, options *Options) (*IrHttps, error) { + ihs := &IrHttps{} + if err := c.SearchRead(IrHttpModel, criteria, options, ihs); err != nil { + return nil, err + } + return ihs, nil +} + +// FindIrHttpIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrHttpIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(IrHttpModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindIrHttpId finds record id by querying it with criteria. +func (c *Client) FindIrHttpId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrHttpModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.http was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_logging.go b/ir_logging.go new file mode 100644 index 00000000..6c2a8a04 --- /dev/null +++ b/ir_logging.go @@ -0,0 +1,126 @@ +package odoo + +import ( + "fmt" +) + +// IrLogging represents ir.logging model. +type IrLogging struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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 *Many2One `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) { + return c.Create(IrLoggingModel, il) +} + +// 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) +} + +// 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 + } + if ils != nil && len(*ils) > 0 { + return &((*ils)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.logging not found", id) +} + +// 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 + } + if ils != nil && len(*ils) > 0 { + return &((*ils)[0]), nil + } + return nil, fmt.Errorf("no ir.logging was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(IrLoggingModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.logging was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_mail_server.go b/ir_mail_server.go new file mode 100644 index 00000000..8a7b1ffa --- /dev/null +++ b/ir_mail_server.go @@ -0,0 +1,127 @@ +package odoo + +import ( + "fmt" +) + +// IrMailServer represents ir.mail_server model. +type IrMailServer struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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"` + 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"` + 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) { + return c.Create(IrMailServerModel, im) +} + +// 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) +} + +// 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 + } + if ims != nil && len(*ims) > 0 { + return &((*ims)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.mail_server not found", id) +} + +// 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 + } + if ims != nil && len(*ims) > 0 { + return &((*ims)[0]), nil + } + return nil, fmt.Errorf("no ir.mail_server was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(IrMailServerModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.mail_server was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_model.go b/ir_model.go index ad687562..461e05f8 100644 --- a/ir_model.go +++ b/ir_model.go @@ -4,41 +4,46 @@ import ( "fmt" ) -// IrModel represents ir.model model +// IrModel represents ir.model model. type IrModel struct { - LastUpdate *Time `xmlrpc:"__last_update,omptempty"` - AccessIds *Relation `xmlrpc:"access_ids,omptempty"` - Count *Int `xmlrpc:"count,omptempty"` - CreateDate *Time `xmlrpc:"create_date,omptempty"` - CreateUid *Many2One `xmlrpc:"create_uid,omptempty"` - DisplayName *String `xmlrpc:"display_name,omptempty"` - FieldId *Relation `xmlrpc:"field_id,omptempty"` - Id *Int `xmlrpc:"id,omptempty"` - Info *String `xmlrpc:"info,omptempty"` - InheritedModelIds *Relation `xmlrpc:"inherited_model_ids,omptempty"` - Model *String `xmlrpc:"model,omptempty"` - Modules *String `xmlrpc:"modules,omptempty"` - Name *String `xmlrpc:"name,omptempty"` - RuleIds *Relation `xmlrpc:"rule_ids,omptempty"` - State *Selection `xmlrpc:"state,omptempty"` - Transient *Bool `xmlrpc:"transient,omptempty"` - ViewIds *Relation `xmlrpc:"view_ids,omptempty"` - WriteDate *Time `xmlrpc:"write_date,omptempty"` - WriteUid *Many2One `xmlrpc:"write_uid,omptempty"` + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AccessIds *Relation `xmlrpc:"access_ids,omitempty"` + Count *Int `xmlrpc:"count,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + FieldId *Relation `xmlrpc:"field_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Info *String `xmlrpc:"info,omitempty"` + InheritedModelIds *Relation `xmlrpc:"inherited_model_ids,omitempty"` + IsMailThread *Bool `xmlrpc:"is_mail_thread,omitempty"` + Model *String `xmlrpc:"model,omitempty"` + Modules *String `xmlrpc:"modules,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + Transient *Bool `xmlrpc:"transient,omitempty"` + ViewIds *Relation `xmlrpc:"view_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` } -// IrModels represents array of ir.model model +// IrModels represents array of ir.model model. type IrModels []IrModel -// IrModelModel is the odoo model name +// IrModelModel is the odoo model name. const IrModelModel = "ir.model" +// Many2One convert IrModel to *Many2One. +func (im *IrModel) Many2One() *Many2One { + return NewMany2One(im.Id.Get(), "") +} + // CreateIrModel creates a new ir.model model and returns its id. func (c *Client) CreateIrModel(im *IrModel) (int64, error) { return c.Create(IrModelModel, im) } -// UpdateIrModel pdates an existing ir.model record. +// UpdateIrModel updates an existing ir.model record. func (c *Client) UpdateIrModel(im *IrModel) error { return c.UpdateIrModels([]int64{im.Id.Get()}, im) } @@ -68,7 +73,7 @@ func (c *Client) GetIrModel(id int64) (*IrModel, error) { if ims != nil && len(*ims) > 0 { return &((*ims)[0]), nil } - return nil, fmt.Errorf("id %v of %s not found", id, IrModelModel) + return nil, fmt.Errorf("id %v of ir.model not found", id) } // GetIrModels gets ir.model existing records. @@ -80,6 +85,18 @@ func (c *Client) GetIrModels(ids []int64) (*IrModels, error) { return ims, nil } +// FindIrModel finds ir.model record by querying it with criteria. +func (c *Client) FindIrModel(criteria *Criteria) (*IrModel, error) { + ims := &IrModels{} + if err := c.SearchRead(IrModelModel, criteria, NewOptions().Limit(1), ims); err != nil { + return nil, err + } + if ims != nil && len(*ims) > 0 { + return &((*ims)[0]), nil + } + return nil, fmt.Errorf("no ir.model was found with criteria %v", criteria) +} + // FindIrModels finds ir.model records by querying it // and filtering it with criteria and options. func (c *Client) FindIrModels(criteria *Criteria, options *Options) (*IrModels, error) { @@ -89,3 +106,25 @@ func (c *Client) FindIrModels(criteria *Criteria, options *Options) (*IrModels, } return ims, nil } + +// FindIrModelIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrModelIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(IrModelModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindIrModelId finds record id by querying it with criteria. +func (c *Client) FindIrModelId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrModelModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.model was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_model_access.go b/ir_model_access.go new file mode 100644 index 00000000..2994b714 --- /dev/null +++ b/ir_model_access.go @@ -0,0 +1,126 @@ +package odoo + +import ( + "fmt" +) + +// IrModelAccess represents ir.model.access model. +type IrModelAccess struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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) { + return c.Create(IrModelAccessModel, ima) +} + +// 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) +} + +// 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 + } + if imas != nil && len(*imas) > 0 { + return &((*imas)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.model.access not found", id) +} + +// 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 + } + if imas != nil && len(*imas) > 0 { + return &((*imas)[0]), nil + } + return nil, fmt.Errorf("no ir.model.access was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(IrModelAccessModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.model.access was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_model_constraint.go b/ir_model_constraint.go new file mode 100644 index 00000000..5417c1bc --- /dev/null +++ b/ir_model_constraint.go @@ -0,0 +1,125 @@ +package odoo + +import ( + "fmt" +) + +// IrModelConstraint represents ir.model.constraint model. +type IrModelConstraint struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DateInit *Time `xmlrpc:"date_init,omitempty"` + DateUpdate *Time `xmlrpc:"date_update,omitempty"` + Definition *String `xmlrpc:"definition,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"` + 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) { + return c.Create(IrModelConstraintModel, imc) +} + +// 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) +} + +// 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 + } + if imcs != nil && len(*imcs) > 0 { + return &((*imcs)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.model.constraint not found", id) +} + +// 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 + } + if imcs != nil && len(*imcs) > 0 { + return &((*imcs)[0]), nil + } + return nil, fmt.Errorf("no ir.model.constraint was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(IrModelConstraintModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.model.constraint was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_model_data.go b/ir_model_data.go new file mode 100644 index 00000000..77bf3765 --- /dev/null +++ b/ir_model_data.go @@ -0,0 +1,127 @@ +package odoo + +import ( + "fmt" +) + +// IrModelData represents ir.model.data model. +type IrModelData struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CompleteName *String `xmlrpc:"complete_name,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DateInit *Time `xmlrpc:"date_init,omitempty"` + DateUpdate *Time `xmlrpc:"date_update,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 *Int `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) { + return c.Create(IrModelDataModel, imd) +} + +// 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) +} + +// 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 + } + if imds != nil && len(*imds) > 0 { + return &((*imds)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.model.data not found", id) +} + +// 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 + } + if imds != nil && len(*imds) > 0 { + return &((*imds)[0]), nil + } + return nil, fmt.Errorf("no ir.model.data was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(IrModelDataModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.model.data was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_model_fields.go b/ir_model_fields.go index 84219701..dba259d1 100644 --- a/ir_model_fields.go +++ b/ir_model_fields.go @@ -4,61 +4,65 @@ import ( "fmt" ) -// IrModelFields represents ir.model.fields model +// IrModelFields represents ir.model.fields model. type IrModelFields struct { - LastUpdate *Time `xmlrpc:"__last_update,omptempty"` - Column1 *String `xmlrpc:"column1,omptempty"` - Column2 *String `xmlrpc:"column2,omptempty"` - CompleteName *String `xmlrpc:"complete_name,omptempty"` - Compute *String `xmlrpc:"compute,omptempty"` - Copied *Bool `xmlrpc:"copied,omptempty"` - CreateDate *Time `xmlrpc:"create_date,omptempty"` - CreateUid *Many2One `xmlrpc:"create_uid,omptempty"` - Depends *String `xmlrpc:"depends,omptempty"` - DisplayName *String `xmlrpc:"display_name,omptempty"` - Domain *String `xmlrpc:"domain,omptempty"` - FieldDescription *String `xmlrpc:"field_description,omptempty"` - Groups *Relation `xmlrpc:"groups,omptempty"` - Help *String `xmlrpc:"help,omptempty"` - Id *Int `xmlrpc:"id,omptempty"` - Index *Bool `xmlrpc:"index,omptempty"` - Model *String `xmlrpc:"model,omptempty"` - ModelId *Many2One `xmlrpc:"model_id,omptempty"` - Modules *String `xmlrpc:"modules,omptempty"` - Name *String `xmlrpc:"name,omptempty"` - OnDelete *Selection `xmlrpc:"on_delete,omptempty"` - Readonly *Bool `xmlrpc:"readonly,omptempty"` - Related *String `xmlrpc:"related,omptempty"` - RelatedFieldId *Many2One `xmlrpc:"related_field_id,omptempty"` - Relation *String `xmlrpc:"relation,omptempty"` - RelationField *String `xmlrpc:"relation_field,omptempty"` - RelationFieldId *Many2One `xmlrpc:"relation_field_id,omptempty"` - RelationTable *String `xmlrpc:"relation_table,omptempty"` - Required *Bool `xmlrpc:"required,omptempty"` - Selectable *Bool `xmlrpc:"selectable,omptempty"` - Selection *String `xmlrpc:"selection,omptempty"` - SelectionIds *Relation `xmlrpc:"selection_ids,omptempty"` - Size *Int `xmlrpc:"size,omptempty"` - State *Selection `xmlrpc:"state,omptempty"` - Store *Bool `xmlrpc:"store,omptempty"` - Translate *Bool `xmlrpc:"translate,omptempty"` - Ttype *Selection `xmlrpc:"ttype,omptempty"` - WriteDate *Time `xmlrpc:"write_date,omptempty"` - WriteUid *Many2One `xmlrpc:"write_uid,omptempty"` + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + Column1 *String `xmlrpc:"column1,omitempty"` + Column2 *String `xmlrpc:"column2,omitempty"` + CompleteName *String `xmlrpc:"complete_name,omitempty"` + Compute *String `xmlrpc:"compute,omitempty"` + Copy *Bool `xmlrpc:"copy,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Depends *String `xmlrpc:"depends,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Domain *String `xmlrpc:"domain,omitempty"` + FieldDescription *String `xmlrpc:"field_description,omitempty"` + Groups *Relation `xmlrpc:"groups,omitempty"` + Help *String `xmlrpc:"help,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Index *Bool `xmlrpc:"index,omitempty"` + Model *String `xmlrpc:"model,omitempty"` + ModelId *Many2One `xmlrpc:"model_id,omitempty"` + Modules *String `xmlrpc:"modules,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + OnDelete *Selection `xmlrpc:"on_delete,omitempty"` + Readonly *Bool `xmlrpc:"readonly,omitempty"` + Related *String `xmlrpc:"related,omitempty"` + Relation *String `xmlrpc:"relation,omitempty"` + RelationField *String `xmlrpc:"relation_field,omitempty"` + RelationTable *String `xmlrpc:"relation_table,omitempty"` + Required *Bool `xmlrpc:"required,omitempty"` + Selectable *Bool `xmlrpc:"selectable,omitempty"` + Selection *String `xmlrpc:"selection,omitempty"` + SerializationFieldId *Many2One `xmlrpc:"serialization_field_id,omitempty"` + Size *Int `xmlrpc:"size,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + Store *Bool `xmlrpc:"store,omitempty"` + TrackVisibility *Selection `xmlrpc:"track_visibility,omitempty"` + Translate *Bool `xmlrpc:"translate,omitempty"` + Ttype *Selection `xmlrpc:"ttype,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` } -// IrModelFieldss represents array of ir.model.fields model +// IrModelFieldss represents array of ir.model.fields model. type IrModelFieldss []IrModelFields -// IrModelFieldsModel is the odoo model name +// IrModelFieldsModel is the odoo model name. const IrModelFieldsModel = "ir.model.fields" +// Many2One convert IrModelFields to *Many2One. +func (imf *IrModelFields) Many2One() *Many2One { + return NewMany2One(imf.Id.Get(), "") +} + // CreateIrModelFields creates a new ir.model.fields model and returns its id. func (c *Client) CreateIrModelFields(imf *IrModelFields) (int64, error) { return c.Create(IrModelFieldsModel, imf) } -// UpdateIrModelFields pdates an existing ir.model.fields record. +// UpdateIrModelFields updates an existing ir.model.fields record. func (c *Client) UpdateIrModelFields(imf *IrModelFields) error { return c.UpdateIrModelFieldss([]int64{imf.Id.Get()}, imf) } @@ -88,7 +92,7 @@ func (c *Client) GetIrModelFields(id int64) (*IrModelFields, error) { if imfs != nil && len(*imfs) > 0 { return &((*imfs)[0]), nil } - return nil, fmt.Errorf("id %v of %s not found", id, IrModelFieldsModel) + return nil, fmt.Errorf("id %v of ir.model.fields not found", id) } // GetIrModelFieldss gets ir.model.fields existing records. @@ -100,6 +104,18 @@ func (c *Client) GetIrModelFieldss(ids []int64) (*IrModelFieldss, error) { return imfs, nil } +// FindIrModelFields finds ir.model.fields record by querying it with criteria. +func (c *Client) FindIrModelFields(criteria *Criteria) (*IrModelFields, error) { + imfs := &IrModelFieldss{} + if err := c.SearchRead(IrModelFieldsModel, criteria, NewOptions().Limit(1), imfs); err != nil { + return nil, err + } + if imfs != nil && len(*imfs) > 0 { + return &((*imfs)[0]), nil + } + return nil, fmt.Errorf("no ir.model.fields was found with criteria %v", criteria) +} + // FindIrModelFieldss finds ir.model.fields records by querying it // and filtering it with criteria and options. func (c *Client) FindIrModelFieldss(criteria *Criteria, options *Options) (*IrModelFieldss, error) { @@ -109,3 +125,25 @@ func (c *Client) FindIrModelFieldss(criteria *Criteria, options *Options) (*IrMo } return imfs, nil } + +// FindIrModelFieldsIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrModelFieldsIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(IrModelFieldsModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindIrModelFieldsId finds record id by querying it with criteria. +func (c *Client) FindIrModelFieldsId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrModelFieldsModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.model.fields was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_model_relation.go b/ir_model_relation.go new file mode 100644 index 00000000..f8dea9af --- /dev/null +++ b/ir_model_relation.go @@ -0,0 +1,123 @@ +package odoo + +import ( + "fmt" +) + +// IrModelRelation represents ir.model.relation model. +type IrModelRelation struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DateInit *Time `xmlrpc:"date_init,omitempty"` + DateUpdate *Time `xmlrpc:"date_update,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) { + return c.Create(IrModelRelationModel, imr) +} + +// 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) +} + +// 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 + } + if imrs != nil && len(*imrs) > 0 { + return &((*imrs)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.model.relation not found", id) +} + +// 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 + } + if imrs != nil && len(*imrs) > 0 { + return &((*imrs)[0]), nil + } + return nil, fmt.Errorf("no ir.model.relation was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(IrModelRelationModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.model.relation was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_module_category.go b/ir_module_category.go new file mode 100644 index 00000000..c72ae867 --- /dev/null +++ b/ir_module_category.go @@ -0,0 +1,128 @@ +package odoo + +import ( + "fmt" +) + +// IrModuleCategory represents ir.module.category model. +type IrModuleCategory struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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"` + ModuleNr *Int `xmlrpc:"module_nr,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) { + return c.Create(IrModuleCategoryModel, imc) +} + +// 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) +} + +// 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 + } + if imcs != nil && len(*imcs) > 0 { + return &((*imcs)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.module.category not found", id) +} + +// 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 + } + if imcs != nil && len(*imcs) > 0 { + return &((*imcs)[0]), nil + } + return nil, fmt.Errorf("no ir.module.category was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(IrModuleCategoryModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.module.category was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_module_module.go b/ir_module_module.go index ac480899..fe892b5b 100644 --- a/ir_module_module.go +++ b/ir_module_module.go @@ -6,40 +6,40 @@ import ( // IrModuleModule represents ir.module.module model. type IrModuleModule struct { - LastUpdate *Time `xmlrpc:"__last_update,omptempty"` - Application *Bool `xmlrpc:"application,omptempty"` - Author *String `xmlrpc:"author,omptempty"` - AutoInstall *Bool `xmlrpc:"auto_install,omptempty"` - CategoryId *Many2One `xmlrpc:"category_id,omptempty"` - Contributors *String `xmlrpc:"contributors,omptempty"` - CreateDate *Time `xmlrpc:"create_date,omptempty"` - CreateUid *Many2One `xmlrpc:"create_uid,omptempty"` - Demo *Bool `xmlrpc:"demo,omptempty"` - DependenciesId *Relation `xmlrpc:"dependencies_id,omptempty"` - Description *String `xmlrpc:"description,omptempty"` - DescriptionHtml *String `xmlrpc:"description_html,omptempty"` - DisplayName *String `xmlrpc:"display_name,omptempty"` - ExclusionIds *Relation `xmlrpc:"exclusion_ids,omptempty"` - Icon *String `xmlrpc:"icon,omptempty"` - IconImage *String `xmlrpc:"icon_image,omptempty"` - Id *Int `xmlrpc:"id,omptempty"` - InstalledVersion *String `xmlrpc:"installed_version,omptempty"` - LatestVersion *String `xmlrpc:"latest_version,omptempty"` - License *Selection `xmlrpc:"license,omptempty"` - Maintainer *String `xmlrpc:"maintainer,omptempty"` - MenusByModule *String `xmlrpc:"menus_by_module,omptempty"` - Name *String `xmlrpc:"name,omptempty"` - PublishedVersion *String `xmlrpc:"published_version,omptempty"` - ReportsByModule *String `xmlrpc:"reports_by_module,omptempty"` - Sequence *Int `xmlrpc:"sequence,omptempty"` - Shortdesc *String `xmlrpc:"shortdesc,omptempty"` - State *Selection `xmlrpc:"state,omptempty"` - Summary *String `xmlrpc:"summary,omptempty"` - Url *String `xmlrpc:"url,omptempty"` - ViewsByModule *String `xmlrpc:"views_by_module,omptempty"` - Website *String `xmlrpc:"website,omptempty"` - WriteDate *Time `xmlrpc:"write_date,omptempty"` - WriteUid *Many2One `xmlrpc:"write_uid,omptempty"` + LastUpdate *Time `xmlrpc:"__last_update,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"` + 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"` + Icon *String `xmlrpc:"icon,omitempty"` + IconImage *String `xmlrpc:"icon_image,omitempty"` + Id *Int `xmlrpc:"id,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"` + 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"` + 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. @@ -109,7 +109,7 @@ func (c *Client) FindIrModuleModule(criteria *Criteria) (*IrModuleModule, error) if imms != nil && len(*imms) > 0 { return &((*imms)[0]), nil } - return nil, fmt.Errorf("ir.module.module was not found") + return nil, fmt.Errorf("no ir.module.module was found with criteria %v", criteria) } // FindIrModuleModules finds ir.module.module records by querying it @@ -141,5 +141,5 @@ func (c *Client) FindIrModuleModuleId(criteria *Criteria, options *Options) (int if len(ids) > 0 { return ids[0], nil } - return -1, fmt.Errorf("ir.module.module was not found") + return -1, fmt.Errorf("no ir.module.module was found with criteria %v and options %v", criteria, options) } diff --git a/ir_module_module_dependency.go b/ir_module_module_dependency.go new file mode 100644 index 00000000..99008a77 --- /dev/null +++ b/ir_module_module_dependency.go @@ -0,0 +1,122 @@ +package odoo + +import ( + "fmt" +) + +// IrModuleModuleDependency represents ir.module.module.dependency model. +type IrModuleModuleDependency struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,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"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,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) { + return c.Create(IrModuleModuleDependencyModel, immd) +} + +// 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) +} + +// 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 + } + if immds != nil && len(*immds) > 0 { + return &((*immds)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.module.module.dependency not found", id) +} + +// 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 + } + if immds != nil && len(*immds) > 0 { + return &((*immds)[0]), nil + } + return nil, fmt.Errorf("no ir.module.module.dependency was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(IrModuleModuleDependencyModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.module.module.dependency was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_module_module_exclusion.go b/ir_module_module_exclusion.go new file mode 100644 index 00000000..ee75443e --- /dev/null +++ b/ir_module_module_exclusion.go @@ -0,0 +1,122 @@ +package odoo + +import ( + "fmt" +) + +// IrModuleModuleExclusion represents ir.module.module.exclusion model. +type IrModuleModuleExclusion struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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) { + return c.Create(IrModuleModuleExclusionModel, imme) +} + +// 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) +} + +// 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 + } + if immes != nil && len(*immes) > 0 { + return &((*immes)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.module.module.exclusion not found", id) +} + +// 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 + } + if immes != nil && len(*immes) > 0 { + return &((*immes)[0]), nil + } + return nil, fmt.Errorf("no ir.module.module.exclusion was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(IrModuleModuleExclusionModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.module.module.exclusion was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_property.go b/ir_property.go new file mode 100644 index 00000000..2cd050ad --- /dev/null +++ b/ir_property.go @@ -0,0 +1,129 @@ +package odoo + +import ( + "fmt" +) + +// IrProperty represents ir.property model. +type IrProperty struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` + FieldsId *Many2One `xmlrpc:"fields_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + ResId *String `xmlrpc:"res_id,omitempty"` + Type *Selection `xmlrpc:"type,omitempty"` + ValueBinary *String `xmlrpc:"value_binary,omitempty"` + ValueDatetime *Time `xmlrpc:"value_datetime,omitempty"` + ValueFloat *Float `xmlrpc:"value_float,omitempty"` + ValueInteger *Int `xmlrpc:"value_integer,omitempty"` + ValueReference *String `xmlrpc:"value_reference,omitempty"` + ValueText *String `xmlrpc:"value_text,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// IrPropertys represents array of ir.property model. +type IrPropertys []IrProperty + +// IrPropertyModel is the odoo model name. +const IrPropertyModel = "ir.property" + +// Many2One convert IrProperty to *Many2One. +func (ip *IrProperty) Many2One() *Many2One { + return NewMany2One(ip.Id.Get(), "") +} + +// CreateIrProperty creates a new ir.property model and returns its id. +func (c *Client) CreateIrProperty(ip *IrProperty) (int64, error) { + return c.Create(IrPropertyModel, ip) +} + +// UpdateIrProperty updates an existing ir.property record. +func (c *Client) UpdateIrProperty(ip *IrProperty) error { + return c.UpdateIrPropertys([]int64{ip.Id.Get()}, ip) +} + +// UpdateIrPropertys updates existing ir.property records. +// All records (represented by ids) will be updated by ip values. +func (c *Client) UpdateIrPropertys(ids []int64, ip *IrProperty) error { + return c.Update(IrPropertyModel, ids, ip) +} + +// DeleteIrProperty deletes an existing ir.property record. +func (c *Client) DeleteIrProperty(id int64) error { + return c.DeleteIrPropertys([]int64{id}) +} + +// DeleteIrPropertys deletes existing ir.property records. +func (c *Client) DeleteIrPropertys(ids []int64) error { + return c.Delete(IrPropertyModel, ids) +} + +// GetIrProperty gets ir.property existing record. +func (c *Client) GetIrProperty(id int64) (*IrProperty, error) { + ips, err := c.GetIrPropertys([]int64{id}) + if err != nil { + return nil, err + } + if ips != nil && len(*ips) > 0 { + return &((*ips)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.property not found", id) +} + +// GetIrPropertys gets ir.property existing records. +func (c *Client) GetIrPropertys(ids []int64) (*IrPropertys, error) { + ips := &IrPropertys{} + if err := c.Read(IrPropertyModel, ids, nil, ips); err != nil { + return nil, err + } + return ips, nil +} + +// FindIrProperty finds ir.property record by querying it with criteria. +func (c *Client) FindIrProperty(criteria *Criteria) (*IrProperty, error) { + ips := &IrPropertys{} + if err := c.SearchRead(IrPropertyModel, criteria, NewOptions().Limit(1), ips); err != nil { + return nil, err + } + if ips != nil && len(*ips) > 0 { + return &((*ips)[0]), nil + } + return nil, fmt.Errorf("no ir.property was found with criteria %v", criteria) +} + +// FindIrPropertys finds ir.property records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrPropertys(criteria *Criteria, options *Options) (*IrPropertys, error) { + ips := &IrPropertys{} + if err := c.SearchRead(IrPropertyModel, criteria, options, ips); err != nil { + return nil, err + } + return ips, nil +} + +// FindIrPropertyIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrPropertyIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(IrPropertyModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindIrPropertyId finds record id by querying it with criteria. +func (c *Client) FindIrPropertyId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrPropertyModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.property was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_qweb.go b/ir_qweb.go new file mode 100644 index 00000000..71dc06e5 --- /dev/null +++ b/ir_qweb.go @@ -0,0 +1,114 @@ +package odoo + +import ( + "fmt" +) + +// IrQweb represents ir.qweb model. +type IrQweb struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` +} + +// IrQwebs represents array of ir.qweb model. +type IrQwebs []IrQweb + +// IrQwebModel is the odoo model name. +const IrQwebModel = "ir.qweb" + +// Many2One convert IrQweb to *Many2One. +func (iq *IrQweb) Many2One() *Many2One { + return NewMany2One(iq.Id.Get(), "") +} + +// CreateIrQweb creates a new ir.qweb model and returns its id. +func (c *Client) CreateIrQweb(iq *IrQweb) (int64, error) { + return c.Create(IrQwebModel, iq) +} + +// UpdateIrQweb updates an existing ir.qweb record. +func (c *Client) UpdateIrQweb(iq *IrQweb) error { + return c.UpdateIrQwebs([]int64{iq.Id.Get()}, iq) +} + +// UpdateIrQwebs updates existing ir.qweb records. +// All records (represented by ids) will be updated by iq values. +func (c *Client) UpdateIrQwebs(ids []int64, iq *IrQweb) error { + return c.Update(IrQwebModel, ids, iq) +} + +// DeleteIrQweb deletes an existing ir.qweb record. +func (c *Client) DeleteIrQweb(id int64) error { + return c.DeleteIrQwebs([]int64{id}) +} + +// DeleteIrQwebs deletes existing ir.qweb records. +func (c *Client) DeleteIrQwebs(ids []int64) error { + return c.Delete(IrQwebModel, ids) +} + +// GetIrQweb gets ir.qweb existing record. +func (c *Client) GetIrQweb(id int64) (*IrQweb, error) { + iqs, err := c.GetIrQwebs([]int64{id}) + if err != nil { + return nil, err + } + if iqs != nil && len(*iqs) > 0 { + return &((*iqs)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.qweb not found", id) +} + +// GetIrQwebs gets ir.qweb existing records. +func (c *Client) GetIrQwebs(ids []int64) (*IrQwebs, error) { + iqs := &IrQwebs{} + if err := c.Read(IrQwebModel, ids, nil, iqs); err != nil { + return nil, err + } + return iqs, nil +} + +// FindIrQweb finds ir.qweb record by querying it with criteria. +func (c *Client) FindIrQweb(criteria *Criteria) (*IrQweb, error) { + iqs := &IrQwebs{} + if err := c.SearchRead(IrQwebModel, criteria, NewOptions().Limit(1), iqs); err != nil { + return nil, err + } + if iqs != nil && len(*iqs) > 0 { + return &((*iqs)[0]), nil + } + return nil, fmt.Errorf("no ir.qweb was found with criteria %v", criteria) +} + +// FindIrQwebs finds ir.qweb records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrQwebs(criteria *Criteria, options *Options) (*IrQwebs, error) { + iqs := &IrQwebs{} + if err := c.SearchRead(IrQwebModel, criteria, options, iqs); err != nil { + return nil, err + } + return iqs, nil +} + +// FindIrQwebIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrQwebIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(IrQwebModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindIrQwebId finds record id by querying it with criteria. +func (c *Client) FindIrQwebId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrQwebModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.qweb was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_qweb_field.go b/ir_qweb_field.go new file mode 100644 index 00000000..2131c5be --- /dev/null +++ b/ir_qweb_field.go @@ -0,0 +1,114 @@ +package odoo + +import ( + "fmt" +) + +// IrQwebField represents ir.qweb.field model. +type IrQwebField struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` +} + +// IrQwebFields represents array of ir.qweb.field model. +type IrQwebFields []IrQwebField + +// IrQwebFieldModel is the odoo model name. +const IrQwebFieldModel = "ir.qweb.field" + +// Many2One convert IrQwebField to *Many2One. +func (iqf *IrQwebField) Many2One() *Many2One { + return NewMany2One(iqf.Id.Get(), "") +} + +// CreateIrQwebField creates a new ir.qweb.field model and returns its id. +func (c *Client) CreateIrQwebField(iqf *IrQwebField) (int64, error) { + return c.Create(IrQwebFieldModel, iqf) +} + +// UpdateIrQwebField updates an existing ir.qweb.field record. +func (c *Client) UpdateIrQwebField(iqf *IrQwebField) error { + return c.UpdateIrQwebFields([]int64{iqf.Id.Get()}, iqf) +} + +// UpdateIrQwebFields updates existing ir.qweb.field records. +// All records (represented by ids) will be updated by iqf values. +func (c *Client) UpdateIrQwebFields(ids []int64, iqf *IrQwebField) error { + return c.Update(IrQwebFieldModel, ids, iqf) +} + +// DeleteIrQwebField deletes an existing ir.qweb.field record. +func (c *Client) DeleteIrQwebField(id int64) error { + return c.DeleteIrQwebFields([]int64{id}) +} + +// DeleteIrQwebFields deletes existing ir.qweb.field records. +func (c *Client) DeleteIrQwebFields(ids []int64) error { + return c.Delete(IrQwebFieldModel, ids) +} + +// GetIrQwebField gets ir.qweb.field existing record. +func (c *Client) GetIrQwebField(id int64) (*IrQwebField, error) { + iqfs, err := c.GetIrQwebFields([]int64{id}) + if err != nil { + return nil, err + } + if iqfs != nil && len(*iqfs) > 0 { + return &((*iqfs)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.qweb.field not found", id) +} + +// GetIrQwebFields gets ir.qweb.field existing records. +func (c *Client) GetIrQwebFields(ids []int64) (*IrQwebFields, error) { + iqfs := &IrQwebFields{} + if err := c.Read(IrQwebFieldModel, ids, nil, iqfs); err != nil { + return nil, err + } + return iqfs, nil +} + +// FindIrQwebField finds ir.qweb.field record by querying it with criteria. +func (c *Client) FindIrQwebField(criteria *Criteria) (*IrQwebField, error) { + iqfs := &IrQwebFields{} + if err := c.SearchRead(IrQwebFieldModel, criteria, NewOptions().Limit(1), iqfs); err != nil { + return nil, err + } + if iqfs != nil && len(*iqfs) > 0 { + return &((*iqfs)[0]), nil + } + return nil, fmt.Errorf("no ir.qweb.field was found with criteria %v", criteria) +} + +// FindIrQwebFields finds ir.qweb.field records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrQwebFields(criteria *Criteria, options *Options) (*IrQwebFields, error) { + iqfs := &IrQwebFields{} + if err := c.SearchRead(IrQwebFieldModel, criteria, options, iqfs); err != nil { + return nil, err + } + return iqfs, nil +} + +// FindIrQwebFieldIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrQwebFieldIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(IrQwebFieldModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindIrQwebFieldId finds record id by querying it with criteria. +func (c *Client) FindIrQwebFieldId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrQwebFieldModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.qweb.field was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_qweb_field_barcode.go b/ir_qweb_field_barcode.go new file mode 100644 index 00000000..c6e1389e --- /dev/null +++ b/ir_qweb_field_barcode.go @@ -0,0 +1,114 @@ +package odoo + +import ( + "fmt" +) + +// IrQwebFieldBarcode represents ir.qweb.field.barcode model. +type IrQwebFieldBarcode struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` +} + +// IrQwebFieldBarcodes represents array of ir.qweb.field.barcode model. +type IrQwebFieldBarcodes []IrQwebFieldBarcode + +// IrQwebFieldBarcodeModel is the odoo model name. +const IrQwebFieldBarcodeModel = "ir.qweb.field.barcode" + +// Many2One convert IrQwebFieldBarcode to *Many2One. +func (iqfb *IrQwebFieldBarcode) Many2One() *Many2One { + return NewMany2One(iqfb.Id.Get(), "") +} + +// CreateIrQwebFieldBarcode creates a new ir.qweb.field.barcode model and returns its id. +func (c *Client) CreateIrQwebFieldBarcode(iqfb *IrQwebFieldBarcode) (int64, error) { + return c.Create(IrQwebFieldBarcodeModel, iqfb) +} + +// UpdateIrQwebFieldBarcode updates an existing ir.qweb.field.barcode record. +func (c *Client) UpdateIrQwebFieldBarcode(iqfb *IrQwebFieldBarcode) error { + return c.UpdateIrQwebFieldBarcodes([]int64{iqfb.Id.Get()}, iqfb) +} + +// UpdateIrQwebFieldBarcodes updates existing ir.qweb.field.barcode records. +// All records (represented by ids) will be updated by iqfb values. +func (c *Client) UpdateIrQwebFieldBarcodes(ids []int64, iqfb *IrQwebFieldBarcode) error { + return c.Update(IrQwebFieldBarcodeModel, ids, iqfb) +} + +// DeleteIrQwebFieldBarcode deletes an existing ir.qweb.field.barcode record. +func (c *Client) DeleteIrQwebFieldBarcode(id int64) error { + return c.DeleteIrQwebFieldBarcodes([]int64{id}) +} + +// DeleteIrQwebFieldBarcodes deletes existing ir.qweb.field.barcode records. +func (c *Client) DeleteIrQwebFieldBarcodes(ids []int64) error { + return c.Delete(IrQwebFieldBarcodeModel, ids) +} + +// GetIrQwebFieldBarcode gets ir.qweb.field.barcode existing record. +func (c *Client) GetIrQwebFieldBarcode(id int64) (*IrQwebFieldBarcode, error) { + iqfbs, err := c.GetIrQwebFieldBarcodes([]int64{id}) + if err != nil { + return nil, err + } + if iqfbs != nil && len(*iqfbs) > 0 { + return &((*iqfbs)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.qweb.field.barcode not found", id) +} + +// GetIrQwebFieldBarcodes gets ir.qweb.field.barcode existing records. +func (c *Client) GetIrQwebFieldBarcodes(ids []int64) (*IrQwebFieldBarcodes, error) { + iqfbs := &IrQwebFieldBarcodes{} + if err := c.Read(IrQwebFieldBarcodeModel, ids, nil, iqfbs); err != nil { + return nil, err + } + return iqfbs, nil +} + +// FindIrQwebFieldBarcode finds ir.qweb.field.barcode record by querying it with criteria. +func (c *Client) FindIrQwebFieldBarcode(criteria *Criteria) (*IrQwebFieldBarcode, error) { + iqfbs := &IrQwebFieldBarcodes{} + if err := c.SearchRead(IrQwebFieldBarcodeModel, criteria, NewOptions().Limit(1), iqfbs); err != nil { + return nil, err + } + if iqfbs != nil && len(*iqfbs) > 0 { + return &((*iqfbs)[0]), nil + } + return nil, fmt.Errorf("no ir.qweb.field.barcode was found with criteria %v", criteria) +} + +// FindIrQwebFieldBarcodes finds ir.qweb.field.barcode records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrQwebFieldBarcodes(criteria *Criteria, options *Options) (*IrQwebFieldBarcodes, error) { + iqfbs := &IrQwebFieldBarcodes{} + if err := c.SearchRead(IrQwebFieldBarcodeModel, criteria, options, iqfbs); err != nil { + return nil, err + } + return iqfbs, nil +} + +// FindIrQwebFieldBarcodeIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrQwebFieldBarcodeIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(IrQwebFieldBarcodeModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindIrQwebFieldBarcodeId finds record id by querying it with criteria. +func (c *Client) FindIrQwebFieldBarcodeId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrQwebFieldBarcodeModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.qweb.field.barcode was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_qweb_field_contact.go b/ir_qweb_field_contact.go new file mode 100644 index 00000000..b1b66c78 --- /dev/null +++ b/ir_qweb_field_contact.go @@ -0,0 +1,114 @@ +package odoo + +import ( + "fmt" +) + +// IrQwebFieldContact represents ir.qweb.field.contact model. +type IrQwebFieldContact struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` +} + +// IrQwebFieldContacts represents array of ir.qweb.field.contact model. +type IrQwebFieldContacts []IrQwebFieldContact + +// IrQwebFieldContactModel is the odoo model name. +const IrQwebFieldContactModel = "ir.qweb.field.contact" + +// Many2One convert IrQwebFieldContact to *Many2One. +func (iqfc *IrQwebFieldContact) Many2One() *Many2One { + return NewMany2One(iqfc.Id.Get(), "") +} + +// CreateIrQwebFieldContact creates a new ir.qweb.field.contact model and returns its id. +func (c *Client) CreateIrQwebFieldContact(iqfc *IrQwebFieldContact) (int64, error) { + return c.Create(IrQwebFieldContactModel, iqfc) +} + +// UpdateIrQwebFieldContact updates an existing ir.qweb.field.contact record. +func (c *Client) UpdateIrQwebFieldContact(iqfc *IrQwebFieldContact) error { + return c.UpdateIrQwebFieldContacts([]int64{iqfc.Id.Get()}, iqfc) +} + +// UpdateIrQwebFieldContacts updates existing ir.qweb.field.contact records. +// All records (represented by ids) will be updated by iqfc values. +func (c *Client) UpdateIrQwebFieldContacts(ids []int64, iqfc *IrQwebFieldContact) error { + return c.Update(IrQwebFieldContactModel, ids, iqfc) +} + +// DeleteIrQwebFieldContact deletes an existing ir.qweb.field.contact record. +func (c *Client) DeleteIrQwebFieldContact(id int64) error { + return c.DeleteIrQwebFieldContacts([]int64{id}) +} + +// DeleteIrQwebFieldContacts deletes existing ir.qweb.field.contact records. +func (c *Client) DeleteIrQwebFieldContacts(ids []int64) error { + return c.Delete(IrQwebFieldContactModel, ids) +} + +// GetIrQwebFieldContact gets ir.qweb.field.contact existing record. +func (c *Client) GetIrQwebFieldContact(id int64) (*IrQwebFieldContact, error) { + iqfcs, err := c.GetIrQwebFieldContacts([]int64{id}) + if err != nil { + return nil, err + } + if iqfcs != nil && len(*iqfcs) > 0 { + return &((*iqfcs)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.qweb.field.contact not found", id) +} + +// GetIrQwebFieldContacts gets ir.qweb.field.contact existing records. +func (c *Client) GetIrQwebFieldContacts(ids []int64) (*IrQwebFieldContacts, error) { + iqfcs := &IrQwebFieldContacts{} + if err := c.Read(IrQwebFieldContactModel, ids, nil, iqfcs); err != nil { + return nil, err + } + return iqfcs, nil +} + +// FindIrQwebFieldContact finds ir.qweb.field.contact record by querying it with criteria. +func (c *Client) FindIrQwebFieldContact(criteria *Criteria) (*IrQwebFieldContact, error) { + iqfcs := &IrQwebFieldContacts{} + if err := c.SearchRead(IrQwebFieldContactModel, criteria, NewOptions().Limit(1), iqfcs); err != nil { + return nil, err + } + if iqfcs != nil && len(*iqfcs) > 0 { + return &((*iqfcs)[0]), nil + } + return nil, fmt.Errorf("no ir.qweb.field.contact was found with criteria %v", criteria) +} + +// FindIrQwebFieldContacts finds ir.qweb.field.contact records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrQwebFieldContacts(criteria *Criteria, options *Options) (*IrQwebFieldContacts, error) { + iqfcs := &IrQwebFieldContacts{} + if err := c.SearchRead(IrQwebFieldContactModel, criteria, options, iqfcs); err != nil { + return nil, err + } + return iqfcs, nil +} + +// FindIrQwebFieldContactIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrQwebFieldContactIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(IrQwebFieldContactModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindIrQwebFieldContactId finds record id by querying it with criteria. +func (c *Client) FindIrQwebFieldContactId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrQwebFieldContactModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.qweb.field.contact was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_qweb_field_date.go b/ir_qweb_field_date.go new file mode 100644 index 00000000..c3b7046e --- /dev/null +++ b/ir_qweb_field_date.go @@ -0,0 +1,114 @@ +package odoo + +import ( + "fmt" +) + +// IrQwebFieldDate represents ir.qweb.field.date model. +type IrQwebFieldDate struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` +} + +// IrQwebFieldDates represents array of ir.qweb.field.date model. +type IrQwebFieldDates []IrQwebFieldDate + +// IrQwebFieldDateModel is the odoo model name. +const IrQwebFieldDateModel = "ir.qweb.field.date" + +// Many2One convert IrQwebFieldDate to *Many2One. +func (iqfd *IrQwebFieldDate) Many2One() *Many2One { + return NewMany2One(iqfd.Id.Get(), "") +} + +// CreateIrQwebFieldDate creates a new ir.qweb.field.date model and returns its id. +func (c *Client) CreateIrQwebFieldDate(iqfd *IrQwebFieldDate) (int64, error) { + return c.Create(IrQwebFieldDateModel, iqfd) +} + +// UpdateIrQwebFieldDate updates an existing ir.qweb.field.date record. +func (c *Client) UpdateIrQwebFieldDate(iqfd *IrQwebFieldDate) error { + return c.UpdateIrQwebFieldDates([]int64{iqfd.Id.Get()}, iqfd) +} + +// UpdateIrQwebFieldDates updates existing ir.qweb.field.date records. +// All records (represented by ids) will be updated by iqfd values. +func (c *Client) UpdateIrQwebFieldDates(ids []int64, iqfd *IrQwebFieldDate) error { + return c.Update(IrQwebFieldDateModel, ids, iqfd) +} + +// DeleteIrQwebFieldDate deletes an existing ir.qweb.field.date record. +func (c *Client) DeleteIrQwebFieldDate(id int64) error { + return c.DeleteIrQwebFieldDates([]int64{id}) +} + +// DeleteIrQwebFieldDates deletes existing ir.qweb.field.date records. +func (c *Client) DeleteIrQwebFieldDates(ids []int64) error { + return c.Delete(IrQwebFieldDateModel, ids) +} + +// GetIrQwebFieldDate gets ir.qweb.field.date existing record. +func (c *Client) GetIrQwebFieldDate(id int64) (*IrQwebFieldDate, error) { + iqfds, err := c.GetIrQwebFieldDates([]int64{id}) + if err != nil { + return nil, err + } + if iqfds != nil && len(*iqfds) > 0 { + return &((*iqfds)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.qweb.field.date not found", id) +} + +// GetIrQwebFieldDates gets ir.qweb.field.date existing records. +func (c *Client) GetIrQwebFieldDates(ids []int64) (*IrQwebFieldDates, error) { + iqfds := &IrQwebFieldDates{} + if err := c.Read(IrQwebFieldDateModel, ids, nil, iqfds); err != nil { + return nil, err + } + return iqfds, nil +} + +// FindIrQwebFieldDate finds ir.qweb.field.date record by querying it with criteria. +func (c *Client) FindIrQwebFieldDate(criteria *Criteria) (*IrQwebFieldDate, error) { + iqfds := &IrQwebFieldDates{} + if err := c.SearchRead(IrQwebFieldDateModel, criteria, NewOptions().Limit(1), iqfds); err != nil { + return nil, err + } + if iqfds != nil && len(*iqfds) > 0 { + return &((*iqfds)[0]), nil + } + return nil, fmt.Errorf("no ir.qweb.field.date was found with criteria %v", criteria) +} + +// FindIrQwebFieldDates finds ir.qweb.field.date records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrQwebFieldDates(criteria *Criteria, options *Options) (*IrQwebFieldDates, error) { + iqfds := &IrQwebFieldDates{} + if err := c.SearchRead(IrQwebFieldDateModel, criteria, options, iqfds); err != nil { + return nil, err + } + return iqfds, nil +} + +// FindIrQwebFieldDateIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrQwebFieldDateIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(IrQwebFieldDateModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindIrQwebFieldDateId finds record id by querying it with criteria. +func (c *Client) FindIrQwebFieldDateId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrQwebFieldDateModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.qweb.field.date was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_qweb_field_datetime.go b/ir_qweb_field_datetime.go new file mode 100644 index 00000000..7aff6289 --- /dev/null +++ b/ir_qweb_field_datetime.go @@ -0,0 +1,114 @@ +package odoo + +import ( + "fmt" +) + +// IrQwebFieldDatetime represents ir.qweb.field.datetime model. +type IrQwebFieldDatetime struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` +} + +// IrQwebFieldDatetimes represents array of ir.qweb.field.datetime model. +type IrQwebFieldDatetimes []IrQwebFieldDatetime + +// IrQwebFieldDatetimeModel is the odoo model name. +const IrQwebFieldDatetimeModel = "ir.qweb.field.datetime" + +// Many2One convert IrQwebFieldDatetime to *Many2One. +func (iqfd *IrQwebFieldDatetime) Many2One() *Many2One { + return NewMany2One(iqfd.Id.Get(), "") +} + +// CreateIrQwebFieldDatetime creates a new ir.qweb.field.datetime model and returns its id. +func (c *Client) CreateIrQwebFieldDatetime(iqfd *IrQwebFieldDatetime) (int64, error) { + return c.Create(IrQwebFieldDatetimeModel, iqfd) +} + +// UpdateIrQwebFieldDatetime updates an existing ir.qweb.field.datetime record. +func (c *Client) UpdateIrQwebFieldDatetime(iqfd *IrQwebFieldDatetime) error { + return c.UpdateIrQwebFieldDatetimes([]int64{iqfd.Id.Get()}, iqfd) +} + +// UpdateIrQwebFieldDatetimes updates existing ir.qweb.field.datetime records. +// All records (represented by ids) will be updated by iqfd values. +func (c *Client) UpdateIrQwebFieldDatetimes(ids []int64, iqfd *IrQwebFieldDatetime) error { + return c.Update(IrQwebFieldDatetimeModel, ids, iqfd) +} + +// DeleteIrQwebFieldDatetime deletes an existing ir.qweb.field.datetime record. +func (c *Client) DeleteIrQwebFieldDatetime(id int64) error { + return c.DeleteIrQwebFieldDatetimes([]int64{id}) +} + +// DeleteIrQwebFieldDatetimes deletes existing ir.qweb.field.datetime records. +func (c *Client) DeleteIrQwebFieldDatetimes(ids []int64) error { + return c.Delete(IrQwebFieldDatetimeModel, ids) +} + +// GetIrQwebFieldDatetime gets ir.qweb.field.datetime existing record. +func (c *Client) GetIrQwebFieldDatetime(id int64) (*IrQwebFieldDatetime, error) { + iqfds, err := c.GetIrQwebFieldDatetimes([]int64{id}) + if err != nil { + return nil, err + } + if iqfds != nil && len(*iqfds) > 0 { + return &((*iqfds)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.qweb.field.datetime not found", id) +} + +// GetIrQwebFieldDatetimes gets ir.qweb.field.datetime existing records. +func (c *Client) GetIrQwebFieldDatetimes(ids []int64) (*IrQwebFieldDatetimes, error) { + iqfds := &IrQwebFieldDatetimes{} + if err := c.Read(IrQwebFieldDatetimeModel, ids, nil, iqfds); err != nil { + return nil, err + } + return iqfds, nil +} + +// FindIrQwebFieldDatetime finds ir.qweb.field.datetime record by querying it with criteria. +func (c *Client) FindIrQwebFieldDatetime(criteria *Criteria) (*IrQwebFieldDatetime, error) { + iqfds := &IrQwebFieldDatetimes{} + if err := c.SearchRead(IrQwebFieldDatetimeModel, criteria, NewOptions().Limit(1), iqfds); err != nil { + return nil, err + } + if iqfds != nil && len(*iqfds) > 0 { + return &((*iqfds)[0]), nil + } + return nil, fmt.Errorf("no ir.qweb.field.datetime was found with criteria %v", criteria) +} + +// FindIrQwebFieldDatetimes finds ir.qweb.field.datetime records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrQwebFieldDatetimes(criteria *Criteria, options *Options) (*IrQwebFieldDatetimes, error) { + iqfds := &IrQwebFieldDatetimes{} + if err := c.SearchRead(IrQwebFieldDatetimeModel, criteria, options, iqfds); err != nil { + return nil, err + } + return iqfds, nil +} + +// FindIrQwebFieldDatetimeIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrQwebFieldDatetimeIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(IrQwebFieldDatetimeModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindIrQwebFieldDatetimeId finds record id by querying it with criteria. +func (c *Client) FindIrQwebFieldDatetimeId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrQwebFieldDatetimeModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.qweb.field.datetime was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_qweb_field_duration.go b/ir_qweb_field_duration.go new file mode 100644 index 00000000..9332028f --- /dev/null +++ b/ir_qweb_field_duration.go @@ -0,0 +1,114 @@ +package odoo + +import ( + "fmt" +) + +// IrQwebFieldDuration represents ir.qweb.field.duration model. +type IrQwebFieldDuration struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` +} + +// IrQwebFieldDurations represents array of ir.qweb.field.duration model. +type IrQwebFieldDurations []IrQwebFieldDuration + +// IrQwebFieldDurationModel is the odoo model name. +const IrQwebFieldDurationModel = "ir.qweb.field.duration" + +// Many2One convert IrQwebFieldDuration to *Many2One. +func (iqfd *IrQwebFieldDuration) Many2One() *Many2One { + return NewMany2One(iqfd.Id.Get(), "") +} + +// CreateIrQwebFieldDuration creates a new ir.qweb.field.duration model and returns its id. +func (c *Client) CreateIrQwebFieldDuration(iqfd *IrQwebFieldDuration) (int64, error) { + return c.Create(IrQwebFieldDurationModel, iqfd) +} + +// UpdateIrQwebFieldDuration updates an existing ir.qweb.field.duration record. +func (c *Client) UpdateIrQwebFieldDuration(iqfd *IrQwebFieldDuration) error { + return c.UpdateIrQwebFieldDurations([]int64{iqfd.Id.Get()}, iqfd) +} + +// UpdateIrQwebFieldDurations updates existing ir.qweb.field.duration records. +// All records (represented by ids) will be updated by iqfd values. +func (c *Client) UpdateIrQwebFieldDurations(ids []int64, iqfd *IrQwebFieldDuration) error { + return c.Update(IrQwebFieldDurationModel, ids, iqfd) +} + +// DeleteIrQwebFieldDuration deletes an existing ir.qweb.field.duration record. +func (c *Client) DeleteIrQwebFieldDuration(id int64) error { + return c.DeleteIrQwebFieldDurations([]int64{id}) +} + +// DeleteIrQwebFieldDurations deletes existing ir.qweb.field.duration records. +func (c *Client) DeleteIrQwebFieldDurations(ids []int64) error { + return c.Delete(IrQwebFieldDurationModel, ids) +} + +// GetIrQwebFieldDuration gets ir.qweb.field.duration existing record. +func (c *Client) GetIrQwebFieldDuration(id int64) (*IrQwebFieldDuration, error) { + iqfds, err := c.GetIrQwebFieldDurations([]int64{id}) + if err != nil { + return nil, err + } + if iqfds != nil && len(*iqfds) > 0 { + return &((*iqfds)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.qweb.field.duration not found", id) +} + +// GetIrQwebFieldDurations gets ir.qweb.field.duration existing records. +func (c *Client) GetIrQwebFieldDurations(ids []int64) (*IrQwebFieldDurations, error) { + iqfds := &IrQwebFieldDurations{} + if err := c.Read(IrQwebFieldDurationModel, ids, nil, iqfds); err != nil { + return nil, err + } + return iqfds, nil +} + +// FindIrQwebFieldDuration finds ir.qweb.field.duration record by querying it with criteria. +func (c *Client) FindIrQwebFieldDuration(criteria *Criteria) (*IrQwebFieldDuration, error) { + iqfds := &IrQwebFieldDurations{} + if err := c.SearchRead(IrQwebFieldDurationModel, criteria, NewOptions().Limit(1), iqfds); err != nil { + return nil, err + } + if iqfds != nil && len(*iqfds) > 0 { + return &((*iqfds)[0]), nil + } + return nil, fmt.Errorf("no ir.qweb.field.duration was found with criteria %v", criteria) +} + +// FindIrQwebFieldDurations finds ir.qweb.field.duration records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrQwebFieldDurations(criteria *Criteria, options *Options) (*IrQwebFieldDurations, error) { + iqfds := &IrQwebFieldDurations{} + if err := c.SearchRead(IrQwebFieldDurationModel, criteria, options, iqfds); err != nil { + return nil, err + } + return iqfds, nil +} + +// FindIrQwebFieldDurationIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrQwebFieldDurationIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(IrQwebFieldDurationModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindIrQwebFieldDurationId finds record id by querying it with criteria. +func (c *Client) FindIrQwebFieldDurationId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrQwebFieldDurationModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.qweb.field.duration was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_qweb_field_float.go b/ir_qweb_field_float.go new file mode 100644 index 00000000..000772dc --- /dev/null +++ b/ir_qweb_field_float.go @@ -0,0 +1,114 @@ +package odoo + +import ( + "fmt" +) + +// IrQwebFieldFloat represents ir.qweb.field.float model. +type IrQwebFieldFloat struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` +} + +// IrQwebFieldFloats represents array of ir.qweb.field.float model. +type IrQwebFieldFloats []IrQwebFieldFloat + +// IrQwebFieldFloatModel is the odoo model name. +const IrQwebFieldFloatModel = "ir.qweb.field.float" + +// Many2One convert IrQwebFieldFloat to *Many2One. +func (iqff *IrQwebFieldFloat) Many2One() *Many2One { + return NewMany2One(iqff.Id.Get(), "") +} + +// CreateIrQwebFieldFloat creates a new ir.qweb.field.float model and returns its id. +func (c *Client) CreateIrQwebFieldFloat(iqff *IrQwebFieldFloat) (int64, error) { + return c.Create(IrQwebFieldFloatModel, iqff) +} + +// UpdateIrQwebFieldFloat updates an existing ir.qweb.field.float record. +func (c *Client) UpdateIrQwebFieldFloat(iqff *IrQwebFieldFloat) error { + return c.UpdateIrQwebFieldFloats([]int64{iqff.Id.Get()}, iqff) +} + +// UpdateIrQwebFieldFloats updates existing ir.qweb.field.float records. +// All records (represented by ids) will be updated by iqff values. +func (c *Client) UpdateIrQwebFieldFloats(ids []int64, iqff *IrQwebFieldFloat) error { + return c.Update(IrQwebFieldFloatModel, ids, iqff) +} + +// DeleteIrQwebFieldFloat deletes an existing ir.qweb.field.float record. +func (c *Client) DeleteIrQwebFieldFloat(id int64) error { + return c.DeleteIrQwebFieldFloats([]int64{id}) +} + +// DeleteIrQwebFieldFloats deletes existing ir.qweb.field.float records. +func (c *Client) DeleteIrQwebFieldFloats(ids []int64) error { + return c.Delete(IrQwebFieldFloatModel, ids) +} + +// GetIrQwebFieldFloat gets ir.qweb.field.float existing record. +func (c *Client) GetIrQwebFieldFloat(id int64) (*IrQwebFieldFloat, error) { + iqffs, err := c.GetIrQwebFieldFloats([]int64{id}) + if err != nil { + return nil, err + } + if iqffs != nil && len(*iqffs) > 0 { + return &((*iqffs)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.qweb.field.float not found", id) +} + +// GetIrQwebFieldFloats gets ir.qweb.field.float existing records. +func (c *Client) GetIrQwebFieldFloats(ids []int64) (*IrQwebFieldFloats, error) { + iqffs := &IrQwebFieldFloats{} + if err := c.Read(IrQwebFieldFloatModel, ids, nil, iqffs); err != nil { + return nil, err + } + return iqffs, nil +} + +// FindIrQwebFieldFloat finds ir.qweb.field.float record by querying it with criteria. +func (c *Client) FindIrQwebFieldFloat(criteria *Criteria) (*IrQwebFieldFloat, error) { + iqffs := &IrQwebFieldFloats{} + if err := c.SearchRead(IrQwebFieldFloatModel, criteria, NewOptions().Limit(1), iqffs); err != nil { + return nil, err + } + if iqffs != nil && len(*iqffs) > 0 { + return &((*iqffs)[0]), nil + } + return nil, fmt.Errorf("no ir.qweb.field.float was found with criteria %v", criteria) +} + +// FindIrQwebFieldFloats finds ir.qweb.field.float records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrQwebFieldFloats(criteria *Criteria, options *Options) (*IrQwebFieldFloats, error) { + iqffs := &IrQwebFieldFloats{} + if err := c.SearchRead(IrQwebFieldFloatModel, criteria, options, iqffs); err != nil { + return nil, err + } + return iqffs, nil +} + +// FindIrQwebFieldFloatIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrQwebFieldFloatIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(IrQwebFieldFloatModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindIrQwebFieldFloatId finds record id by querying it with criteria. +func (c *Client) FindIrQwebFieldFloatId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrQwebFieldFloatModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.qweb.field.float was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_qweb_field_float_time.go b/ir_qweb_field_float_time.go new file mode 100644 index 00000000..1449b419 --- /dev/null +++ b/ir_qweb_field_float_time.go @@ -0,0 +1,114 @@ +package odoo + +import ( + "fmt" +) + +// IrQwebFieldFloatTime represents ir.qweb.field.float_time model. +type IrQwebFieldFloatTime struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` +} + +// IrQwebFieldFloatTimes represents array of ir.qweb.field.float_time model. +type IrQwebFieldFloatTimes []IrQwebFieldFloatTime + +// IrQwebFieldFloatTimeModel is the odoo model name. +const IrQwebFieldFloatTimeModel = "ir.qweb.field.float_time" + +// Many2One convert IrQwebFieldFloatTime to *Many2One. +func (iqff *IrQwebFieldFloatTime) Many2One() *Many2One { + return NewMany2One(iqff.Id.Get(), "") +} + +// CreateIrQwebFieldFloatTime creates a new ir.qweb.field.float_time model and returns its id. +func (c *Client) CreateIrQwebFieldFloatTime(iqff *IrQwebFieldFloatTime) (int64, error) { + return c.Create(IrQwebFieldFloatTimeModel, iqff) +} + +// UpdateIrQwebFieldFloatTime updates an existing ir.qweb.field.float_time record. +func (c *Client) UpdateIrQwebFieldFloatTime(iqff *IrQwebFieldFloatTime) error { + return c.UpdateIrQwebFieldFloatTimes([]int64{iqff.Id.Get()}, iqff) +} + +// UpdateIrQwebFieldFloatTimes updates existing ir.qweb.field.float_time records. +// All records (represented by ids) will be updated by iqff values. +func (c *Client) UpdateIrQwebFieldFloatTimes(ids []int64, iqff *IrQwebFieldFloatTime) error { + return c.Update(IrQwebFieldFloatTimeModel, ids, iqff) +} + +// DeleteIrQwebFieldFloatTime deletes an existing ir.qweb.field.float_time record. +func (c *Client) DeleteIrQwebFieldFloatTime(id int64) error { + return c.DeleteIrQwebFieldFloatTimes([]int64{id}) +} + +// DeleteIrQwebFieldFloatTimes deletes existing ir.qweb.field.float_time records. +func (c *Client) DeleteIrQwebFieldFloatTimes(ids []int64) error { + return c.Delete(IrQwebFieldFloatTimeModel, ids) +} + +// GetIrQwebFieldFloatTime gets ir.qweb.field.float_time existing record. +func (c *Client) GetIrQwebFieldFloatTime(id int64) (*IrQwebFieldFloatTime, error) { + iqffs, err := c.GetIrQwebFieldFloatTimes([]int64{id}) + if err != nil { + return nil, err + } + if iqffs != nil && len(*iqffs) > 0 { + return &((*iqffs)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.qweb.field.float_time not found", id) +} + +// GetIrQwebFieldFloatTimes gets ir.qweb.field.float_time existing records. +func (c *Client) GetIrQwebFieldFloatTimes(ids []int64) (*IrQwebFieldFloatTimes, error) { + iqffs := &IrQwebFieldFloatTimes{} + if err := c.Read(IrQwebFieldFloatTimeModel, ids, nil, iqffs); err != nil { + return nil, err + } + return iqffs, nil +} + +// FindIrQwebFieldFloatTime finds ir.qweb.field.float_time record by querying it with criteria. +func (c *Client) FindIrQwebFieldFloatTime(criteria *Criteria) (*IrQwebFieldFloatTime, error) { + iqffs := &IrQwebFieldFloatTimes{} + if err := c.SearchRead(IrQwebFieldFloatTimeModel, criteria, NewOptions().Limit(1), iqffs); err != nil { + return nil, err + } + if iqffs != nil && len(*iqffs) > 0 { + return &((*iqffs)[0]), nil + } + return nil, fmt.Errorf("no ir.qweb.field.float_time was found with criteria %v", criteria) +} + +// FindIrQwebFieldFloatTimes finds ir.qweb.field.float_time records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrQwebFieldFloatTimes(criteria *Criteria, options *Options) (*IrQwebFieldFloatTimes, error) { + iqffs := &IrQwebFieldFloatTimes{} + if err := c.SearchRead(IrQwebFieldFloatTimeModel, criteria, options, iqffs); err != nil { + return nil, err + } + return iqffs, nil +} + +// FindIrQwebFieldFloatTimeIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrQwebFieldFloatTimeIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(IrQwebFieldFloatTimeModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindIrQwebFieldFloatTimeId finds record id by querying it with criteria. +func (c *Client) FindIrQwebFieldFloatTimeId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrQwebFieldFloatTimeModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.qweb.field.float_time was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_qweb_field_html.go b/ir_qweb_field_html.go new file mode 100644 index 00000000..61aaea9d --- /dev/null +++ b/ir_qweb_field_html.go @@ -0,0 +1,114 @@ +package odoo + +import ( + "fmt" +) + +// IrQwebFieldHtml represents ir.qweb.field.html model. +type IrQwebFieldHtml struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` +} + +// IrQwebFieldHtmls represents array of ir.qweb.field.html model. +type IrQwebFieldHtmls []IrQwebFieldHtml + +// IrQwebFieldHtmlModel is the odoo model name. +const IrQwebFieldHtmlModel = "ir.qweb.field.html" + +// Many2One convert IrQwebFieldHtml to *Many2One. +func (iqfh *IrQwebFieldHtml) Many2One() *Many2One { + return NewMany2One(iqfh.Id.Get(), "") +} + +// CreateIrQwebFieldHtml creates a new ir.qweb.field.html model and returns its id. +func (c *Client) CreateIrQwebFieldHtml(iqfh *IrQwebFieldHtml) (int64, error) { + return c.Create(IrQwebFieldHtmlModel, iqfh) +} + +// UpdateIrQwebFieldHtml updates an existing ir.qweb.field.html record. +func (c *Client) UpdateIrQwebFieldHtml(iqfh *IrQwebFieldHtml) error { + return c.UpdateIrQwebFieldHtmls([]int64{iqfh.Id.Get()}, iqfh) +} + +// UpdateIrQwebFieldHtmls updates existing ir.qweb.field.html records. +// All records (represented by ids) will be updated by iqfh values. +func (c *Client) UpdateIrQwebFieldHtmls(ids []int64, iqfh *IrQwebFieldHtml) error { + return c.Update(IrQwebFieldHtmlModel, ids, iqfh) +} + +// DeleteIrQwebFieldHtml deletes an existing ir.qweb.field.html record. +func (c *Client) DeleteIrQwebFieldHtml(id int64) error { + return c.DeleteIrQwebFieldHtmls([]int64{id}) +} + +// DeleteIrQwebFieldHtmls deletes existing ir.qweb.field.html records. +func (c *Client) DeleteIrQwebFieldHtmls(ids []int64) error { + return c.Delete(IrQwebFieldHtmlModel, ids) +} + +// GetIrQwebFieldHtml gets ir.qweb.field.html existing record. +func (c *Client) GetIrQwebFieldHtml(id int64) (*IrQwebFieldHtml, error) { + iqfhs, err := c.GetIrQwebFieldHtmls([]int64{id}) + if err != nil { + return nil, err + } + if iqfhs != nil && len(*iqfhs) > 0 { + return &((*iqfhs)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.qweb.field.html not found", id) +} + +// GetIrQwebFieldHtmls gets ir.qweb.field.html existing records. +func (c *Client) GetIrQwebFieldHtmls(ids []int64) (*IrQwebFieldHtmls, error) { + iqfhs := &IrQwebFieldHtmls{} + if err := c.Read(IrQwebFieldHtmlModel, ids, nil, iqfhs); err != nil { + return nil, err + } + return iqfhs, nil +} + +// FindIrQwebFieldHtml finds ir.qweb.field.html record by querying it with criteria. +func (c *Client) FindIrQwebFieldHtml(criteria *Criteria) (*IrQwebFieldHtml, error) { + iqfhs := &IrQwebFieldHtmls{} + if err := c.SearchRead(IrQwebFieldHtmlModel, criteria, NewOptions().Limit(1), iqfhs); err != nil { + return nil, err + } + if iqfhs != nil && len(*iqfhs) > 0 { + return &((*iqfhs)[0]), nil + } + return nil, fmt.Errorf("no ir.qweb.field.html was found with criteria %v", criteria) +} + +// FindIrQwebFieldHtmls finds ir.qweb.field.html records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrQwebFieldHtmls(criteria *Criteria, options *Options) (*IrQwebFieldHtmls, error) { + iqfhs := &IrQwebFieldHtmls{} + if err := c.SearchRead(IrQwebFieldHtmlModel, criteria, options, iqfhs); err != nil { + return nil, err + } + return iqfhs, nil +} + +// FindIrQwebFieldHtmlIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrQwebFieldHtmlIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(IrQwebFieldHtmlModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindIrQwebFieldHtmlId finds record id by querying it with criteria. +func (c *Client) FindIrQwebFieldHtmlId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrQwebFieldHtmlModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.qweb.field.html was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_qweb_field_image.go b/ir_qweb_field_image.go new file mode 100644 index 00000000..433f6242 --- /dev/null +++ b/ir_qweb_field_image.go @@ -0,0 +1,114 @@ +package odoo + +import ( + "fmt" +) + +// IrQwebFieldImage represents ir.qweb.field.image model. +type IrQwebFieldImage struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` +} + +// IrQwebFieldImages represents array of ir.qweb.field.image model. +type IrQwebFieldImages []IrQwebFieldImage + +// IrQwebFieldImageModel is the odoo model name. +const IrQwebFieldImageModel = "ir.qweb.field.image" + +// Many2One convert IrQwebFieldImage to *Many2One. +func (iqfi *IrQwebFieldImage) Many2One() *Many2One { + return NewMany2One(iqfi.Id.Get(), "") +} + +// CreateIrQwebFieldImage creates a new ir.qweb.field.image model and returns its id. +func (c *Client) CreateIrQwebFieldImage(iqfi *IrQwebFieldImage) (int64, error) { + return c.Create(IrQwebFieldImageModel, iqfi) +} + +// UpdateIrQwebFieldImage updates an existing ir.qweb.field.image record. +func (c *Client) UpdateIrQwebFieldImage(iqfi *IrQwebFieldImage) error { + return c.UpdateIrQwebFieldImages([]int64{iqfi.Id.Get()}, iqfi) +} + +// UpdateIrQwebFieldImages updates existing ir.qweb.field.image records. +// All records (represented by ids) will be updated by iqfi values. +func (c *Client) UpdateIrQwebFieldImages(ids []int64, iqfi *IrQwebFieldImage) error { + return c.Update(IrQwebFieldImageModel, ids, iqfi) +} + +// DeleteIrQwebFieldImage deletes an existing ir.qweb.field.image record. +func (c *Client) DeleteIrQwebFieldImage(id int64) error { + return c.DeleteIrQwebFieldImages([]int64{id}) +} + +// DeleteIrQwebFieldImages deletes existing ir.qweb.field.image records. +func (c *Client) DeleteIrQwebFieldImages(ids []int64) error { + return c.Delete(IrQwebFieldImageModel, ids) +} + +// GetIrQwebFieldImage gets ir.qweb.field.image existing record. +func (c *Client) GetIrQwebFieldImage(id int64) (*IrQwebFieldImage, error) { + iqfis, err := c.GetIrQwebFieldImages([]int64{id}) + if err != nil { + return nil, err + } + if iqfis != nil && len(*iqfis) > 0 { + return &((*iqfis)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.qweb.field.image not found", id) +} + +// GetIrQwebFieldImages gets ir.qweb.field.image existing records. +func (c *Client) GetIrQwebFieldImages(ids []int64) (*IrQwebFieldImages, error) { + iqfis := &IrQwebFieldImages{} + if err := c.Read(IrQwebFieldImageModel, ids, nil, iqfis); err != nil { + return nil, err + } + return iqfis, nil +} + +// FindIrQwebFieldImage finds ir.qweb.field.image record by querying it with criteria. +func (c *Client) FindIrQwebFieldImage(criteria *Criteria) (*IrQwebFieldImage, error) { + iqfis := &IrQwebFieldImages{} + if err := c.SearchRead(IrQwebFieldImageModel, criteria, NewOptions().Limit(1), iqfis); err != nil { + return nil, err + } + if iqfis != nil && len(*iqfis) > 0 { + return &((*iqfis)[0]), nil + } + return nil, fmt.Errorf("no ir.qweb.field.image was found with criteria %v", criteria) +} + +// FindIrQwebFieldImages finds ir.qweb.field.image records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrQwebFieldImages(criteria *Criteria, options *Options) (*IrQwebFieldImages, error) { + iqfis := &IrQwebFieldImages{} + if err := c.SearchRead(IrQwebFieldImageModel, criteria, options, iqfis); err != nil { + return nil, err + } + return iqfis, nil +} + +// FindIrQwebFieldImageIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrQwebFieldImageIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(IrQwebFieldImageModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindIrQwebFieldImageId finds record id by querying it with criteria. +func (c *Client) FindIrQwebFieldImageId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrQwebFieldImageModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.qweb.field.image was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_qweb_field_integer.go b/ir_qweb_field_integer.go new file mode 100644 index 00000000..f1d78764 --- /dev/null +++ b/ir_qweb_field_integer.go @@ -0,0 +1,114 @@ +package odoo + +import ( + "fmt" +) + +// IrQwebFieldInteger represents ir.qweb.field.integer model. +type IrQwebFieldInteger struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` +} + +// IrQwebFieldIntegers represents array of ir.qweb.field.integer model. +type IrQwebFieldIntegers []IrQwebFieldInteger + +// IrQwebFieldIntegerModel is the odoo model name. +const IrQwebFieldIntegerModel = "ir.qweb.field.integer" + +// Many2One convert IrQwebFieldInteger to *Many2One. +func (iqfi *IrQwebFieldInteger) Many2One() *Many2One { + return NewMany2One(iqfi.Id.Get(), "") +} + +// CreateIrQwebFieldInteger creates a new ir.qweb.field.integer model and returns its id. +func (c *Client) CreateIrQwebFieldInteger(iqfi *IrQwebFieldInteger) (int64, error) { + return c.Create(IrQwebFieldIntegerModel, iqfi) +} + +// UpdateIrQwebFieldInteger updates an existing ir.qweb.field.integer record. +func (c *Client) UpdateIrQwebFieldInteger(iqfi *IrQwebFieldInteger) error { + return c.UpdateIrQwebFieldIntegers([]int64{iqfi.Id.Get()}, iqfi) +} + +// UpdateIrQwebFieldIntegers updates existing ir.qweb.field.integer records. +// All records (represented by ids) will be updated by iqfi values. +func (c *Client) UpdateIrQwebFieldIntegers(ids []int64, iqfi *IrQwebFieldInteger) error { + return c.Update(IrQwebFieldIntegerModel, ids, iqfi) +} + +// DeleteIrQwebFieldInteger deletes an existing ir.qweb.field.integer record. +func (c *Client) DeleteIrQwebFieldInteger(id int64) error { + return c.DeleteIrQwebFieldIntegers([]int64{id}) +} + +// DeleteIrQwebFieldIntegers deletes existing ir.qweb.field.integer records. +func (c *Client) DeleteIrQwebFieldIntegers(ids []int64) error { + return c.Delete(IrQwebFieldIntegerModel, ids) +} + +// GetIrQwebFieldInteger gets ir.qweb.field.integer existing record. +func (c *Client) GetIrQwebFieldInteger(id int64) (*IrQwebFieldInteger, error) { + iqfis, err := c.GetIrQwebFieldIntegers([]int64{id}) + if err != nil { + return nil, err + } + if iqfis != nil && len(*iqfis) > 0 { + return &((*iqfis)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.qweb.field.integer not found", id) +} + +// GetIrQwebFieldIntegers gets ir.qweb.field.integer existing records. +func (c *Client) GetIrQwebFieldIntegers(ids []int64) (*IrQwebFieldIntegers, error) { + iqfis := &IrQwebFieldIntegers{} + if err := c.Read(IrQwebFieldIntegerModel, ids, nil, iqfis); err != nil { + return nil, err + } + return iqfis, nil +} + +// FindIrQwebFieldInteger finds ir.qweb.field.integer record by querying it with criteria. +func (c *Client) FindIrQwebFieldInteger(criteria *Criteria) (*IrQwebFieldInteger, error) { + iqfis := &IrQwebFieldIntegers{} + if err := c.SearchRead(IrQwebFieldIntegerModel, criteria, NewOptions().Limit(1), iqfis); err != nil { + return nil, err + } + if iqfis != nil && len(*iqfis) > 0 { + return &((*iqfis)[0]), nil + } + return nil, fmt.Errorf("no ir.qweb.field.integer was found with criteria %v", criteria) +} + +// FindIrQwebFieldIntegers finds ir.qweb.field.integer records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrQwebFieldIntegers(criteria *Criteria, options *Options) (*IrQwebFieldIntegers, error) { + iqfis := &IrQwebFieldIntegers{} + if err := c.SearchRead(IrQwebFieldIntegerModel, criteria, options, iqfis); err != nil { + return nil, err + } + return iqfis, nil +} + +// FindIrQwebFieldIntegerIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrQwebFieldIntegerIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(IrQwebFieldIntegerModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindIrQwebFieldIntegerId finds record id by querying it with criteria. +func (c *Client) FindIrQwebFieldIntegerId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrQwebFieldIntegerModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.qweb.field.integer was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_qweb_field_many2one.go b/ir_qweb_field_many2one.go new file mode 100644 index 00000000..595781c6 --- /dev/null +++ b/ir_qweb_field_many2one.go @@ -0,0 +1,114 @@ +package odoo + +import ( + "fmt" +) + +// IrQwebFieldMany2One represents ir.qweb.field.many2one model. +type IrQwebFieldMany2One struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` +} + +// IrQwebFieldMany2Ones represents array of ir.qweb.field.many2one model. +type IrQwebFieldMany2Ones []IrQwebFieldMany2One + +// IrQwebFieldMany2OneModel is the odoo model name. +const IrQwebFieldMany2OneModel = "ir.qweb.field.many2one" + +// Many2One convert IrQwebFieldMany2One to *Many2One. +func (iqfm *IrQwebFieldMany2One) Many2One() *Many2One { + return NewMany2One(iqfm.Id.Get(), "") +} + +// CreateIrQwebFieldMany2One creates a new ir.qweb.field.many2one model and returns its id. +func (c *Client) CreateIrQwebFieldMany2One(iqfm *IrQwebFieldMany2One) (int64, error) { + return c.Create(IrQwebFieldMany2OneModel, iqfm) +} + +// UpdateIrQwebFieldMany2One updates an existing ir.qweb.field.many2one record. +func (c *Client) UpdateIrQwebFieldMany2One(iqfm *IrQwebFieldMany2One) error { + return c.UpdateIrQwebFieldMany2Ones([]int64{iqfm.Id.Get()}, iqfm) +} + +// UpdateIrQwebFieldMany2Ones updates existing ir.qweb.field.many2one records. +// All records (represented by ids) will be updated by iqfm values. +func (c *Client) UpdateIrQwebFieldMany2Ones(ids []int64, iqfm *IrQwebFieldMany2One) error { + return c.Update(IrQwebFieldMany2OneModel, ids, iqfm) +} + +// DeleteIrQwebFieldMany2One deletes an existing ir.qweb.field.many2one record. +func (c *Client) DeleteIrQwebFieldMany2One(id int64) error { + return c.DeleteIrQwebFieldMany2Ones([]int64{id}) +} + +// DeleteIrQwebFieldMany2Ones deletes existing ir.qweb.field.many2one records. +func (c *Client) DeleteIrQwebFieldMany2Ones(ids []int64) error { + return c.Delete(IrQwebFieldMany2OneModel, ids) +} + +// GetIrQwebFieldMany2One gets ir.qweb.field.many2one existing record. +func (c *Client) GetIrQwebFieldMany2One(id int64) (*IrQwebFieldMany2One, error) { + iqfms, err := c.GetIrQwebFieldMany2Ones([]int64{id}) + if err != nil { + return nil, err + } + if iqfms != nil && len(*iqfms) > 0 { + return &((*iqfms)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.qweb.field.many2one not found", id) +} + +// GetIrQwebFieldMany2Ones gets ir.qweb.field.many2one existing records. +func (c *Client) GetIrQwebFieldMany2Ones(ids []int64) (*IrQwebFieldMany2Ones, error) { + iqfms := &IrQwebFieldMany2Ones{} + if err := c.Read(IrQwebFieldMany2OneModel, ids, nil, iqfms); err != nil { + return nil, err + } + return iqfms, nil +} + +// FindIrQwebFieldMany2One finds ir.qweb.field.many2one record by querying it with criteria. +func (c *Client) FindIrQwebFieldMany2One(criteria *Criteria) (*IrQwebFieldMany2One, error) { + iqfms := &IrQwebFieldMany2Ones{} + if err := c.SearchRead(IrQwebFieldMany2OneModel, criteria, NewOptions().Limit(1), iqfms); err != nil { + return nil, err + } + if iqfms != nil && len(*iqfms) > 0 { + return &((*iqfms)[0]), nil + } + return nil, fmt.Errorf("no ir.qweb.field.many2one was found with criteria %v", criteria) +} + +// FindIrQwebFieldMany2Ones finds ir.qweb.field.many2one records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrQwebFieldMany2Ones(criteria *Criteria, options *Options) (*IrQwebFieldMany2Ones, error) { + iqfms := &IrQwebFieldMany2Ones{} + if err := c.SearchRead(IrQwebFieldMany2OneModel, criteria, options, iqfms); err != nil { + return nil, err + } + return iqfms, nil +} + +// FindIrQwebFieldMany2OneIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrQwebFieldMany2OneIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(IrQwebFieldMany2OneModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindIrQwebFieldMany2OneId finds record id by querying it with criteria. +func (c *Client) FindIrQwebFieldMany2OneId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrQwebFieldMany2OneModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.qweb.field.many2one was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_qweb_field_monetary.go b/ir_qweb_field_monetary.go new file mode 100644 index 00000000..3038a642 --- /dev/null +++ b/ir_qweb_field_monetary.go @@ -0,0 +1,114 @@ +package odoo + +import ( + "fmt" +) + +// IrQwebFieldMonetary represents ir.qweb.field.monetary model. +type IrQwebFieldMonetary struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` +} + +// IrQwebFieldMonetarys represents array of ir.qweb.field.monetary model. +type IrQwebFieldMonetarys []IrQwebFieldMonetary + +// IrQwebFieldMonetaryModel is the odoo model name. +const IrQwebFieldMonetaryModel = "ir.qweb.field.monetary" + +// Many2One convert IrQwebFieldMonetary to *Many2One. +func (iqfm *IrQwebFieldMonetary) Many2One() *Many2One { + return NewMany2One(iqfm.Id.Get(), "") +} + +// CreateIrQwebFieldMonetary creates a new ir.qweb.field.monetary model and returns its id. +func (c *Client) CreateIrQwebFieldMonetary(iqfm *IrQwebFieldMonetary) (int64, error) { + return c.Create(IrQwebFieldMonetaryModel, iqfm) +} + +// UpdateIrQwebFieldMonetary updates an existing ir.qweb.field.monetary record. +func (c *Client) UpdateIrQwebFieldMonetary(iqfm *IrQwebFieldMonetary) error { + return c.UpdateIrQwebFieldMonetarys([]int64{iqfm.Id.Get()}, iqfm) +} + +// UpdateIrQwebFieldMonetarys updates existing ir.qweb.field.monetary records. +// All records (represented by ids) will be updated by iqfm values. +func (c *Client) UpdateIrQwebFieldMonetarys(ids []int64, iqfm *IrQwebFieldMonetary) error { + return c.Update(IrQwebFieldMonetaryModel, ids, iqfm) +} + +// DeleteIrQwebFieldMonetary deletes an existing ir.qweb.field.monetary record. +func (c *Client) DeleteIrQwebFieldMonetary(id int64) error { + return c.DeleteIrQwebFieldMonetarys([]int64{id}) +} + +// DeleteIrQwebFieldMonetarys deletes existing ir.qweb.field.monetary records. +func (c *Client) DeleteIrQwebFieldMonetarys(ids []int64) error { + return c.Delete(IrQwebFieldMonetaryModel, ids) +} + +// GetIrQwebFieldMonetary gets ir.qweb.field.monetary existing record. +func (c *Client) GetIrQwebFieldMonetary(id int64) (*IrQwebFieldMonetary, error) { + iqfms, err := c.GetIrQwebFieldMonetarys([]int64{id}) + if err != nil { + return nil, err + } + if iqfms != nil && len(*iqfms) > 0 { + return &((*iqfms)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.qweb.field.monetary not found", id) +} + +// GetIrQwebFieldMonetarys gets ir.qweb.field.monetary existing records. +func (c *Client) GetIrQwebFieldMonetarys(ids []int64) (*IrQwebFieldMonetarys, error) { + iqfms := &IrQwebFieldMonetarys{} + if err := c.Read(IrQwebFieldMonetaryModel, ids, nil, iqfms); err != nil { + return nil, err + } + return iqfms, nil +} + +// FindIrQwebFieldMonetary finds ir.qweb.field.monetary record by querying it with criteria. +func (c *Client) FindIrQwebFieldMonetary(criteria *Criteria) (*IrQwebFieldMonetary, error) { + iqfms := &IrQwebFieldMonetarys{} + if err := c.SearchRead(IrQwebFieldMonetaryModel, criteria, NewOptions().Limit(1), iqfms); err != nil { + return nil, err + } + if iqfms != nil && len(*iqfms) > 0 { + return &((*iqfms)[0]), nil + } + return nil, fmt.Errorf("no ir.qweb.field.monetary was found with criteria %v", criteria) +} + +// FindIrQwebFieldMonetarys finds ir.qweb.field.monetary records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrQwebFieldMonetarys(criteria *Criteria, options *Options) (*IrQwebFieldMonetarys, error) { + iqfms := &IrQwebFieldMonetarys{} + if err := c.SearchRead(IrQwebFieldMonetaryModel, criteria, options, iqfms); err != nil { + return nil, err + } + return iqfms, nil +} + +// FindIrQwebFieldMonetaryIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrQwebFieldMonetaryIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(IrQwebFieldMonetaryModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindIrQwebFieldMonetaryId finds record id by querying it with criteria. +func (c *Client) FindIrQwebFieldMonetaryId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrQwebFieldMonetaryModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.qweb.field.monetary was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_qweb_field_qweb.go b/ir_qweb_field_qweb.go new file mode 100644 index 00000000..8d241f4a --- /dev/null +++ b/ir_qweb_field_qweb.go @@ -0,0 +1,114 @@ +package odoo + +import ( + "fmt" +) + +// IrQwebFieldQweb represents ir.qweb.field.qweb model. +type IrQwebFieldQweb struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` +} + +// IrQwebFieldQwebs represents array of ir.qweb.field.qweb model. +type IrQwebFieldQwebs []IrQwebFieldQweb + +// IrQwebFieldQwebModel is the odoo model name. +const IrQwebFieldQwebModel = "ir.qweb.field.qweb" + +// Many2One convert IrQwebFieldQweb to *Many2One. +func (iqfq *IrQwebFieldQweb) Many2One() *Many2One { + return NewMany2One(iqfq.Id.Get(), "") +} + +// CreateIrQwebFieldQweb creates a new ir.qweb.field.qweb model and returns its id. +func (c *Client) CreateIrQwebFieldQweb(iqfq *IrQwebFieldQweb) (int64, error) { + return c.Create(IrQwebFieldQwebModel, iqfq) +} + +// UpdateIrQwebFieldQweb updates an existing ir.qweb.field.qweb record. +func (c *Client) UpdateIrQwebFieldQweb(iqfq *IrQwebFieldQweb) error { + return c.UpdateIrQwebFieldQwebs([]int64{iqfq.Id.Get()}, iqfq) +} + +// UpdateIrQwebFieldQwebs updates existing ir.qweb.field.qweb records. +// All records (represented by ids) will be updated by iqfq values. +func (c *Client) UpdateIrQwebFieldQwebs(ids []int64, iqfq *IrQwebFieldQweb) error { + return c.Update(IrQwebFieldQwebModel, ids, iqfq) +} + +// DeleteIrQwebFieldQweb deletes an existing ir.qweb.field.qweb record. +func (c *Client) DeleteIrQwebFieldQweb(id int64) error { + return c.DeleteIrQwebFieldQwebs([]int64{id}) +} + +// DeleteIrQwebFieldQwebs deletes existing ir.qweb.field.qweb records. +func (c *Client) DeleteIrQwebFieldQwebs(ids []int64) error { + return c.Delete(IrQwebFieldQwebModel, ids) +} + +// GetIrQwebFieldQweb gets ir.qweb.field.qweb existing record. +func (c *Client) GetIrQwebFieldQweb(id int64) (*IrQwebFieldQweb, error) { + iqfqs, err := c.GetIrQwebFieldQwebs([]int64{id}) + if err != nil { + return nil, err + } + if iqfqs != nil && len(*iqfqs) > 0 { + return &((*iqfqs)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.qweb.field.qweb not found", id) +} + +// GetIrQwebFieldQwebs gets ir.qweb.field.qweb existing records. +func (c *Client) GetIrQwebFieldQwebs(ids []int64) (*IrQwebFieldQwebs, error) { + iqfqs := &IrQwebFieldQwebs{} + if err := c.Read(IrQwebFieldQwebModel, ids, nil, iqfqs); err != nil { + return nil, err + } + return iqfqs, nil +} + +// FindIrQwebFieldQweb finds ir.qweb.field.qweb record by querying it with criteria. +func (c *Client) FindIrQwebFieldQweb(criteria *Criteria) (*IrQwebFieldQweb, error) { + iqfqs := &IrQwebFieldQwebs{} + if err := c.SearchRead(IrQwebFieldQwebModel, criteria, NewOptions().Limit(1), iqfqs); err != nil { + return nil, err + } + if iqfqs != nil && len(*iqfqs) > 0 { + return &((*iqfqs)[0]), nil + } + return nil, fmt.Errorf("no ir.qweb.field.qweb was found with criteria %v", criteria) +} + +// FindIrQwebFieldQwebs finds ir.qweb.field.qweb records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrQwebFieldQwebs(criteria *Criteria, options *Options) (*IrQwebFieldQwebs, error) { + iqfqs := &IrQwebFieldQwebs{} + if err := c.SearchRead(IrQwebFieldQwebModel, criteria, options, iqfqs); err != nil { + return nil, err + } + return iqfqs, nil +} + +// FindIrQwebFieldQwebIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrQwebFieldQwebIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(IrQwebFieldQwebModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindIrQwebFieldQwebId finds record id by querying it with criteria. +func (c *Client) FindIrQwebFieldQwebId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrQwebFieldQwebModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.qweb.field.qweb was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_qweb_field_relative.go b/ir_qweb_field_relative.go new file mode 100644 index 00000000..653afcd4 --- /dev/null +++ b/ir_qweb_field_relative.go @@ -0,0 +1,114 @@ +package odoo + +import ( + "fmt" +) + +// IrQwebFieldRelative represents ir.qweb.field.relative model. +type IrQwebFieldRelative struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` +} + +// IrQwebFieldRelatives represents array of ir.qweb.field.relative model. +type IrQwebFieldRelatives []IrQwebFieldRelative + +// IrQwebFieldRelativeModel is the odoo model name. +const IrQwebFieldRelativeModel = "ir.qweb.field.relative" + +// Many2One convert IrQwebFieldRelative to *Many2One. +func (iqfr *IrQwebFieldRelative) Many2One() *Many2One { + return NewMany2One(iqfr.Id.Get(), "") +} + +// CreateIrQwebFieldRelative creates a new ir.qweb.field.relative model and returns its id. +func (c *Client) CreateIrQwebFieldRelative(iqfr *IrQwebFieldRelative) (int64, error) { + return c.Create(IrQwebFieldRelativeModel, iqfr) +} + +// UpdateIrQwebFieldRelative updates an existing ir.qweb.field.relative record. +func (c *Client) UpdateIrQwebFieldRelative(iqfr *IrQwebFieldRelative) error { + return c.UpdateIrQwebFieldRelatives([]int64{iqfr.Id.Get()}, iqfr) +} + +// UpdateIrQwebFieldRelatives updates existing ir.qweb.field.relative records. +// All records (represented by ids) will be updated by iqfr values. +func (c *Client) UpdateIrQwebFieldRelatives(ids []int64, iqfr *IrQwebFieldRelative) error { + return c.Update(IrQwebFieldRelativeModel, ids, iqfr) +} + +// DeleteIrQwebFieldRelative deletes an existing ir.qweb.field.relative record. +func (c *Client) DeleteIrQwebFieldRelative(id int64) error { + return c.DeleteIrQwebFieldRelatives([]int64{id}) +} + +// DeleteIrQwebFieldRelatives deletes existing ir.qweb.field.relative records. +func (c *Client) DeleteIrQwebFieldRelatives(ids []int64) error { + return c.Delete(IrQwebFieldRelativeModel, ids) +} + +// GetIrQwebFieldRelative gets ir.qweb.field.relative existing record. +func (c *Client) GetIrQwebFieldRelative(id int64) (*IrQwebFieldRelative, error) { + iqfrs, err := c.GetIrQwebFieldRelatives([]int64{id}) + if err != nil { + return nil, err + } + if iqfrs != nil && len(*iqfrs) > 0 { + return &((*iqfrs)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.qweb.field.relative not found", id) +} + +// GetIrQwebFieldRelatives gets ir.qweb.field.relative existing records. +func (c *Client) GetIrQwebFieldRelatives(ids []int64) (*IrQwebFieldRelatives, error) { + iqfrs := &IrQwebFieldRelatives{} + if err := c.Read(IrQwebFieldRelativeModel, ids, nil, iqfrs); err != nil { + return nil, err + } + return iqfrs, nil +} + +// FindIrQwebFieldRelative finds ir.qweb.field.relative record by querying it with criteria. +func (c *Client) FindIrQwebFieldRelative(criteria *Criteria) (*IrQwebFieldRelative, error) { + iqfrs := &IrQwebFieldRelatives{} + if err := c.SearchRead(IrQwebFieldRelativeModel, criteria, NewOptions().Limit(1), iqfrs); err != nil { + return nil, err + } + if iqfrs != nil && len(*iqfrs) > 0 { + return &((*iqfrs)[0]), nil + } + return nil, fmt.Errorf("no ir.qweb.field.relative was found with criteria %v", criteria) +} + +// FindIrQwebFieldRelatives finds ir.qweb.field.relative records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrQwebFieldRelatives(criteria *Criteria, options *Options) (*IrQwebFieldRelatives, error) { + iqfrs := &IrQwebFieldRelatives{} + if err := c.SearchRead(IrQwebFieldRelativeModel, criteria, options, iqfrs); err != nil { + return nil, err + } + return iqfrs, nil +} + +// FindIrQwebFieldRelativeIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrQwebFieldRelativeIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(IrQwebFieldRelativeModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindIrQwebFieldRelativeId finds record id by querying it with criteria. +func (c *Client) FindIrQwebFieldRelativeId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrQwebFieldRelativeModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.qweb.field.relative was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_qweb_field_selection.go b/ir_qweb_field_selection.go new file mode 100644 index 00000000..5dc03a84 --- /dev/null +++ b/ir_qweb_field_selection.go @@ -0,0 +1,114 @@ +package odoo + +import ( + "fmt" +) + +// IrQwebFieldSelection represents ir.qweb.field.selection model. +type IrQwebFieldSelection struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` +} + +// IrQwebFieldSelections represents array of ir.qweb.field.selection model. +type IrQwebFieldSelections []IrQwebFieldSelection + +// IrQwebFieldSelectionModel is the odoo model name. +const IrQwebFieldSelectionModel = "ir.qweb.field.selection" + +// Many2One convert IrQwebFieldSelection to *Many2One. +func (iqfs *IrQwebFieldSelection) Many2One() *Many2One { + return NewMany2One(iqfs.Id.Get(), "") +} + +// CreateIrQwebFieldSelection creates a new ir.qweb.field.selection model and returns its id. +func (c *Client) CreateIrQwebFieldSelection(iqfs *IrQwebFieldSelection) (int64, error) { + return c.Create(IrQwebFieldSelectionModel, iqfs) +} + +// UpdateIrQwebFieldSelection updates an existing ir.qweb.field.selection record. +func (c *Client) UpdateIrQwebFieldSelection(iqfs *IrQwebFieldSelection) error { + return c.UpdateIrQwebFieldSelections([]int64{iqfs.Id.Get()}, iqfs) +} + +// UpdateIrQwebFieldSelections updates existing ir.qweb.field.selection records. +// All records (represented by ids) will be updated by iqfs values. +func (c *Client) UpdateIrQwebFieldSelections(ids []int64, iqfs *IrQwebFieldSelection) error { + return c.Update(IrQwebFieldSelectionModel, ids, iqfs) +} + +// DeleteIrQwebFieldSelection deletes an existing ir.qweb.field.selection record. +func (c *Client) DeleteIrQwebFieldSelection(id int64) error { + return c.DeleteIrQwebFieldSelections([]int64{id}) +} + +// DeleteIrQwebFieldSelections deletes existing ir.qweb.field.selection records. +func (c *Client) DeleteIrQwebFieldSelections(ids []int64) error { + return c.Delete(IrQwebFieldSelectionModel, ids) +} + +// GetIrQwebFieldSelection gets ir.qweb.field.selection existing record. +func (c *Client) GetIrQwebFieldSelection(id int64) (*IrQwebFieldSelection, error) { + iqfss, err := c.GetIrQwebFieldSelections([]int64{id}) + if err != nil { + return nil, err + } + if iqfss != nil && len(*iqfss) > 0 { + return &((*iqfss)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.qweb.field.selection not found", id) +} + +// GetIrQwebFieldSelections gets ir.qweb.field.selection existing records. +func (c *Client) GetIrQwebFieldSelections(ids []int64) (*IrQwebFieldSelections, error) { + iqfss := &IrQwebFieldSelections{} + if err := c.Read(IrQwebFieldSelectionModel, ids, nil, iqfss); err != nil { + return nil, err + } + return iqfss, nil +} + +// FindIrQwebFieldSelection finds ir.qweb.field.selection record by querying it with criteria. +func (c *Client) FindIrQwebFieldSelection(criteria *Criteria) (*IrQwebFieldSelection, error) { + iqfss := &IrQwebFieldSelections{} + if err := c.SearchRead(IrQwebFieldSelectionModel, criteria, NewOptions().Limit(1), iqfss); err != nil { + return nil, err + } + if iqfss != nil && len(*iqfss) > 0 { + return &((*iqfss)[0]), nil + } + return nil, fmt.Errorf("no ir.qweb.field.selection was found with criteria %v", criteria) +} + +// FindIrQwebFieldSelections finds ir.qweb.field.selection records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrQwebFieldSelections(criteria *Criteria, options *Options) (*IrQwebFieldSelections, error) { + iqfss := &IrQwebFieldSelections{} + if err := c.SearchRead(IrQwebFieldSelectionModel, criteria, options, iqfss); err != nil { + return nil, err + } + return iqfss, nil +} + +// FindIrQwebFieldSelectionIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrQwebFieldSelectionIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(IrQwebFieldSelectionModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindIrQwebFieldSelectionId finds record id by querying it with criteria. +func (c *Client) FindIrQwebFieldSelectionId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrQwebFieldSelectionModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.qweb.field.selection was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_qweb_field_text.go b/ir_qweb_field_text.go new file mode 100644 index 00000000..7421803e --- /dev/null +++ b/ir_qweb_field_text.go @@ -0,0 +1,114 @@ +package odoo + +import ( + "fmt" +) + +// IrQwebFieldText represents ir.qweb.field.text model. +type IrQwebFieldText struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` +} + +// IrQwebFieldTexts represents array of ir.qweb.field.text model. +type IrQwebFieldTexts []IrQwebFieldText + +// IrQwebFieldTextModel is the odoo model name. +const IrQwebFieldTextModel = "ir.qweb.field.text" + +// Many2One convert IrQwebFieldText to *Many2One. +func (iqft *IrQwebFieldText) Many2One() *Many2One { + return NewMany2One(iqft.Id.Get(), "") +} + +// CreateIrQwebFieldText creates a new ir.qweb.field.text model and returns its id. +func (c *Client) CreateIrQwebFieldText(iqft *IrQwebFieldText) (int64, error) { + return c.Create(IrQwebFieldTextModel, iqft) +} + +// UpdateIrQwebFieldText updates an existing ir.qweb.field.text record. +func (c *Client) UpdateIrQwebFieldText(iqft *IrQwebFieldText) error { + return c.UpdateIrQwebFieldTexts([]int64{iqft.Id.Get()}, iqft) +} + +// UpdateIrQwebFieldTexts updates existing ir.qweb.field.text records. +// All records (represented by ids) will be updated by iqft values. +func (c *Client) UpdateIrQwebFieldTexts(ids []int64, iqft *IrQwebFieldText) error { + return c.Update(IrQwebFieldTextModel, ids, iqft) +} + +// DeleteIrQwebFieldText deletes an existing ir.qweb.field.text record. +func (c *Client) DeleteIrQwebFieldText(id int64) error { + return c.DeleteIrQwebFieldTexts([]int64{id}) +} + +// DeleteIrQwebFieldTexts deletes existing ir.qweb.field.text records. +func (c *Client) DeleteIrQwebFieldTexts(ids []int64) error { + return c.Delete(IrQwebFieldTextModel, ids) +} + +// GetIrQwebFieldText gets ir.qweb.field.text existing record. +func (c *Client) GetIrQwebFieldText(id int64) (*IrQwebFieldText, error) { + iqfts, err := c.GetIrQwebFieldTexts([]int64{id}) + if err != nil { + return nil, err + } + if iqfts != nil && len(*iqfts) > 0 { + return &((*iqfts)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.qweb.field.text not found", id) +} + +// GetIrQwebFieldTexts gets ir.qweb.field.text existing records. +func (c *Client) GetIrQwebFieldTexts(ids []int64) (*IrQwebFieldTexts, error) { + iqfts := &IrQwebFieldTexts{} + if err := c.Read(IrQwebFieldTextModel, ids, nil, iqfts); err != nil { + return nil, err + } + return iqfts, nil +} + +// FindIrQwebFieldText finds ir.qweb.field.text record by querying it with criteria. +func (c *Client) FindIrQwebFieldText(criteria *Criteria) (*IrQwebFieldText, error) { + iqfts := &IrQwebFieldTexts{} + if err := c.SearchRead(IrQwebFieldTextModel, criteria, NewOptions().Limit(1), iqfts); err != nil { + return nil, err + } + if iqfts != nil && len(*iqfts) > 0 { + return &((*iqfts)[0]), nil + } + return nil, fmt.Errorf("no ir.qweb.field.text was found with criteria %v", criteria) +} + +// FindIrQwebFieldTexts finds ir.qweb.field.text records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrQwebFieldTexts(criteria *Criteria, options *Options) (*IrQwebFieldTexts, error) { + iqfts := &IrQwebFieldTexts{} + if err := c.SearchRead(IrQwebFieldTextModel, criteria, options, iqfts); err != nil { + return nil, err + } + return iqfts, nil +} + +// FindIrQwebFieldTextIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrQwebFieldTextIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(IrQwebFieldTextModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindIrQwebFieldTextId finds record id by querying it with criteria. +func (c *Client) FindIrQwebFieldTextId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrQwebFieldTextModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.qweb.field.text was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_rule.go b/ir_rule.go new file mode 100644 index 00000000..048560d3 --- /dev/null +++ b/ir_rule.go @@ -0,0 +1,128 @@ +package odoo + +import ( + "fmt" +) + +// IrRule represents ir.rule model. +type IrRule struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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) { + return c.Create(IrRuleModel, ir) +} + +// 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) +} + +// 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 + } + if irs != nil && len(*irs) > 0 { + return &((*irs)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.rule not found", id) +} + +// 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 + } + if irs != nil && len(*irs) > 0 { + return &((*irs)[0]), nil + } + return nil, fmt.Errorf("no ir.rule was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(IrRuleModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.rule was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_sequence.go b/ir_sequence.go new file mode 100644 index 00000000..30ec62d6 --- /dev/null +++ b/ir_sequence.go @@ -0,0 +1,131 @@ +package odoo + +import ( + "fmt" +) + +// IrSequence represents ir.sequence model. +type IrSequence struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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) { + return c.Create(IrSequenceModel, is) +} + +// 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) +} + +// 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 + } + if iss != nil && len(*iss) > 0 { + return &((*iss)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.sequence not found", id) +} + +// 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 + } + if iss != nil && len(*iss) > 0 { + return &((*iss)[0]), nil + } + return nil, fmt.Errorf("no ir.sequence was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(IrSequenceModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.sequence was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_sequence_date_range.go b/ir_sequence_date_range.go new file mode 100644 index 00000000..cb16a1ce --- /dev/null +++ b/ir_sequence_date_range.go @@ -0,0 +1,123 @@ +package odoo + +import ( + "fmt" +) + +// IrSequenceDateRange represents ir.sequence.date_range model. +type IrSequenceDateRange struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` + 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) { + return c.Create(IrSequenceDateRangeModel, isd) +} + +// 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) +} + +// 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 + } + if isds != nil && len(*isds) > 0 { + return &((*isds)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.sequence.date_range not found", id) +} + +// 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 + } + if isds != nil && len(*isds) > 0 { + return &((*isds)[0]), nil + } + return nil, fmt.Errorf("no ir.sequence.date_range was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(IrSequenceDateRangeModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.sequence.date_range was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_server_object_lines.go b/ir_server_object_lines.go new file mode 100644 index 00000000..d56e9acc --- /dev/null +++ b/ir_server_object_lines.go @@ -0,0 +1,122 @@ +package odoo + +import ( + "fmt" +) + +// IrServerObjectLines represents ir.server.object.lines model. +type IrServerObjectLines struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + Col1 *Many2One `xmlrpc:"col1,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + ServerId *Many2One `xmlrpc:"server_id,omitempty"` + Type *Selection `xmlrpc:"type,omitempty"` + Value *String `xmlrpc:"value,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// IrServerObjectLiness represents array of ir.server.object.lines model. +type IrServerObjectLiness []IrServerObjectLines + +// IrServerObjectLinesModel is the odoo model name. +const IrServerObjectLinesModel = "ir.server.object.lines" + +// Many2One convert IrServerObjectLines to *Many2One. +func (isol *IrServerObjectLines) Many2One() *Many2One { + return NewMany2One(isol.Id.Get(), "") +} + +// CreateIrServerObjectLines creates a new ir.server.object.lines model and returns its id. +func (c *Client) CreateIrServerObjectLines(isol *IrServerObjectLines) (int64, error) { + return c.Create(IrServerObjectLinesModel, isol) +} + +// UpdateIrServerObjectLines updates an existing ir.server.object.lines record. +func (c *Client) UpdateIrServerObjectLines(isol *IrServerObjectLines) error { + return c.UpdateIrServerObjectLiness([]int64{isol.Id.Get()}, isol) +} + +// UpdateIrServerObjectLiness updates existing ir.server.object.lines records. +// All records (represented by ids) will be updated by isol values. +func (c *Client) UpdateIrServerObjectLiness(ids []int64, isol *IrServerObjectLines) error { + return c.Update(IrServerObjectLinesModel, ids, isol) +} + +// DeleteIrServerObjectLines deletes an existing ir.server.object.lines record. +func (c *Client) DeleteIrServerObjectLines(id int64) error { + return c.DeleteIrServerObjectLiness([]int64{id}) +} + +// DeleteIrServerObjectLiness deletes existing ir.server.object.lines records. +func (c *Client) DeleteIrServerObjectLiness(ids []int64) error { + return c.Delete(IrServerObjectLinesModel, ids) +} + +// GetIrServerObjectLines gets ir.server.object.lines existing record. +func (c *Client) GetIrServerObjectLines(id int64) (*IrServerObjectLines, error) { + isols, err := c.GetIrServerObjectLiness([]int64{id}) + if err != nil { + return nil, err + } + if isols != nil && len(*isols) > 0 { + return &((*isols)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.server.object.lines not found", id) +} + +// GetIrServerObjectLiness gets ir.server.object.lines existing records. +func (c *Client) GetIrServerObjectLiness(ids []int64) (*IrServerObjectLiness, error) { + isols := &IrServerObjectLiness{} + if err := c.Read(IrServerObjectLinesModel, ids, nil, isols); err != nil { + return nil, err + } + return isols, nil +} + +// FindIrServerObjectLines finds ir.server.object.lines record by querying it with criteria. +func (c *Client) FindIrServerObjectLines(criteria *Criteria) (*IrServerObjectLines, error) { + isols := &IrServerObjectLiness{} + if err := c.SearchRead(IrServerObjectLinesModel, criteria, NewOptions().Limit(1), isols); err != nil { + return nil, err + } + if isols != nil && len(*isols) > 0 { + return &((*isols)[0]), nil + } + return nil, fmt.Errorf("no ir.server.object.lines was found with criteria %v", criteria) +} + +// FindIrServerObjectLiness finds ir.server.object.lines records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrServerObjectLiness(criteria *Criteria, options *Options) (*IrServerObjectLiness, error) { + isols := &IrServerObjectLiness{} + if err := c.SearchRead(IrServerObjectLinesModel, criteria, options, isols); err != nil { + return nil, err + } + return isols, nil +} + +// FindIrServerObjectLinesIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrServerObjectLinesIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(IrServerObjectLinesModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindIrServerObjectLinesId finds record id by querying it with criteria. +func (c *Client) FindIrServerObjectLinesId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrServerObjectLinesModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.server.object.lines was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_translation.go b/ir_translation.go new file mode 100644 index 00000000..c3a6b5fe --- /dev/null +++ b/ir_translation.go @@ -0,0 +1,124 @@ +package odoo + +import ( + "fmt" +) + +// IrTranslation represents ir.translation model. +type IrTranslation struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + Comments *String `xmlrpc:"comments,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Lang *Selection `xmlrpc:"lang,omitempty"` + Module *String `xmlrpc:"module,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + ResId *Int `xmlrpc:"res_id,omitempty"` + Source *String `xmlrpc:"source,omitempty"` + Src *String `xmlrpc:"src,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + Type *Selection `xmlrpc:"type,omitempty"` + Value *String `xmlrpc:"value,omitempty"` +} + +// IrTranslations represents array of ir.translation model. +type IrTranslations []IrTranslation + +// IrTranslationModel is the odoo model name. +const IrTranslationModel = "ir.translation" + +// Many2One convert IrTranslation to *Many2One. +func (it *IrTranslation) Many2One() *Many2One { + return NewMany2One(it.Id.Get(), "") +} + +// CreateIrTranslation creates a new ir.translation model and returns its id. +func (c *Client) CreateIrTranslation(it *IrTranslation) (int64, error) { + return c.Create(IrTranslationModel, it) +} + +// UpdateIrTranslation updates an existing ir.translation record. +func (c *Client) UpdateIrTranslation(it *IrTranslation) error { + return c.UpdateIrTranslations([]int64{it.Id.Get()}, it) +} + +// UpdateIrTranslations updates existing ir.translation records. +// All records (represented by ids) will be updated by it values. +func (c *Client) UpdateIrTranslations(ids []int64, it *IrTranslation) error { + return c.Update(IrTranslationModel, ids, it) +} + +// DeleteIrTranslation deletes an existing ir.translation record. +func (c *Client) DeleteIrTranslation(id int64) error { + return c.DeleteIrTranslations([]int64{id}) +} + +// DeleteIrTranslations deletes existing ir.translation records. +func (c *Client) DeleteIrTranslations(ids []int64) error { + return c.Delete(IrTranslationModel, ids) +} + +// GetIrTranslation gets ir.translation existing record. +func (c *Client) GetIrTranslation(id int64) (*IrTranslation, error) { + its, err := c.GetIrTranslations([]int64{id}) + if err != nil { + return nil, err + } + if its != nil && len(*its) > 0 { + return &((*its)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.translation not found", id) +} + +// GetIrTranslations gets ir.translation existing records. +func (c *Client) GetIrTranslations(ids []int64) (*IrTranslations, error) { + its := &IrTranslations{} + if err := c.Read(IrTranslationModel, ids, nil, its); err != nil { + return nil, err + } + return its, nil +} + +// FindIrTranslation finds ir.translation record by querying it with criteria. +func (c *Client) FindIrTranslation(criteria *Criteria) (*IrTranslation, error) { + its := &IrTranslations{} + if err := c.SearchRead(IrTranslationModel, criteria, NewOptions().Limit(1), its); err != nil { + return nil, err + } + if its != nil && len(*its) > 0 { + return &((*its)[0]), nil + } + return nil, fmt.Errorf("no ir.translation was found with criteria %v", criteria) +} + +// FindIrTranslations finds ir.translation records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrTranslations(criteria *Criteria, options *Options) (*IrTranslations, error) { + its := &IrTranslations{} + if err := c.SearchRead(IrTranslationModel, criteria, options, its); err != nil { + return nil, err + } + return its, nil +} + +// FindIrTranslationIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrTranslationIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(IrTranslationModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindIrTranslationId finds record id by querying it with criteria. +func (c *Client) FindIrTranslationId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrTranslationModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.translation was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_ui_menu.go b/ir_ui_menu.go new file mode 100644 index 00000000..45d37508 --- /dev/null +++ b/ir_ui_menu.go @@ -0,0 +1,130 @@ +package odoo + +import ( + "fmt" +) + +// IrUiMenu represents ir.ui.menu model. +type IrUiMenu struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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"` + ParentLeft *Int `xmlrpc:"parent_left,omitempty"` + ParentRight *Int `xmlrpc:"parent_right,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) { + return c.Create(IrUiMenuModel, ium) +} + +// 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) +} + +// 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 + } + if iums != nil && len(*iums) > 0 { + return &((*iums)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.ui.menu not found", id) +} + +// 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 + } + if iums != nil && len(*iums) > 0 { + return &((*iums)[0]), nil + } + return nil, fmt.Errorf("no ir.ui.menu was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(IrUiMenuModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.ui.menu was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_ui_view.go b/ir_ui_view.go new file mode 100644 index 00000000..449e858d --- /dev/null +++ b/ir_ui_view.go @@ -0,0 +1,136 @@ +package odoo + +import ( + "fmt" +) + +// IrUiView represents ir.ui.view model. +type IrUiView struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + FieldParent *String `xmlrpc:"field_parent,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"` + ModelIds *Relation `xmlrpc:"model_ids,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Priority *Int `xmlrpc:"priority,omitempty"` + Type *Selection `xmlrpc:"type,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) { + return c.Create(IrUiViewModel, iuv) +} + +// 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) +} + +// 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 + } + if iuvs != nil && len(*iuvs) > 0 { + return &((*iuvs)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.ui.view not found", id) +} + +// 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 + } + if iuvs != nil && len(*iuvs) > 0 { + return &((*iuvs)[0]), nil + } + return nil, fmt.Errorf("no ir.ui.view was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(IrUiViewModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.ui.view was found with criteria %v and options %v", criteria, options) +} diff --git a/ir_ui_view_custom.go b/ir_ui_view_custom.go new file mode 100644 index 00000000..a49b042c --- /dev/null +++ b/ir_ui_view_custom.go @@ -0,0 +1,121 @@ +package odoo + +import ( + "fmt" +) + +// IrUiViewCustom represents ir.ui.view.custom model. +type IrUiViewCustom struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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) { + return c.Create(IrUiViewCustomModel, iuvc) +} + +// 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) +} + +// 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 + } + if iuvcs != nil && len(*iuvcs) > 0 { + return &((*iuvcs)[0]), nil + } + return nil, fmt.Errorf("id %v of ir.ui.view.custom not found", id) +} + +// 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 + } + if iuvcs != nil && len(*iuvcs) > 0 { + return &((*iuvcs)[0]), nil + } + return nil, fmt.Errorf("no ir.ui.view.custom was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(IrUiViewCustomModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no ir.ui.view.custom was found with criteria %v and options %v", criteria, options) +} diff --git a/link_tracker.go b/link_tracker.go new file mode 100644 index 00000000..63298ed4 --- /dev/null +++ b/link_tracker.go @@ -0,0 +1,134 @@ +package odoo + +import ( + "fmt" +) + +// LinkTracker represents link.tracker model. +type LinkTracker struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CampaignId *Many2One `xmlrpc:"campaign_id,omitempty"` + Code *String `xmlrpc:"code,omitempty"` + Count *Int `xmlrpc:"count,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Favicon *String `xmlrpc:"favicon,omitempty"` + IconSrc *String `xmlrpc:"icon_src,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LinkClickIds *Relation `xmlrpc:"link_click_ids,omitempty"` + LinkCodeIds *Relation `xmlrpc:"link_code_ids,omitempty"` + MassMailingCampaignId *Many2One `xmlrpc:"mass_mailing_campaign_id,omitempty"` + MassMailingId *Many2One `xmlrpc:"mass_mailing_id,omitempty"` + MediumId *Many2One `xmlrpc:"medium_id,omitempty"` + RedirectedUrl *String `xmlrpc:"redirected_url,omitempty"` + ShortUrl *String `xmlrpc:"short_url,omitempty"` + ShortUrlHost *String `xmlrpc:"short_url_host,omitempty"` + SourceId *Many2One `xmlrpc:"source_id,omitempty"` + Title *String `xmlrpc:"title,omitempty"` + Url *String `xmlrpc:"url,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// LinkTrackers represents array of link.tracker model. +type LinkTrackers []LinkTracker + +// LinkTrackerModel is the odoo model name. +const LinkTrackerModel = "link.tracker" + +// Many2One convert LinkTracker to *Many2One. +func (lt *LinkTracker) Many2One() *Many2One { + return NewMany2One(lt.Id.Get(), "") +} + +// CreateLinkTracker creates a new link.tracker model and returns its id. +func (c *Client) CreateLinkTracker(lt *LinkTracker) (int64, error) { + return c.Create(LinkTrackerModel, lt) +} + +// UpdateLinkTracker updates an existing link.tracker record. +func (c *Client) UpdateLinkTracker(lt *LinkTracker) error { + return c.UpdateLinkTrackers([]int64{lt.Id.Get()}, lt) +} + +// UpdateLinkTrackers updates existing link.tracker records. +// All records (represented by ids) will be updated by lt values. +func (c *Client) UpdateLinkTrackers(ids []int64, lt *LinkTracker) error { + return c.Update(LinkTrackerModel, ids, lt) +} + +// DeleteLinkTracker deletes an existing link.tracker record. +func (c *Client) DeleteLinkTracker(id int64) error { + return c.DeleteLinkTrackers([]int64{id}) +} + +// DeleteLinkTrackers deletes existing link.tracker records. +func (c *Client) DeleteLinkTrackers(ids []int64) error { + return c.Delete(LinkTrackerModel, ids) +} + +// GetLinkTracker gets link.tracker existing record. +func (c *Client) GetLinkTracker(id int64) (*LinkTracker, error) { + lts, err := c.GetLinkTrackers([]int64{id}) + if err != nil { + return nil, err + } + if lts != nil && len(*lts) > 0 { + return &((*lts)[0]), nil + } + return nil, fmt.Errorf("id %v of link.tracker not found", id) +} + +// GetLinkTrackers gets link.tracker existing records. +func (c *Client) GetLinkTrackers(ids []int64) (*LinkTrackers, error) { + lts := &LinkTrackers{} + if err := c.Read(LinkTrackerModel, ids, nil, lts); err != nil { + return nil, err + } + return lts, nil +} + +// FindLinkTracker finds link.tracker record by querying it with criteria. +func (c *Client) FindLinkTracker(criteria *Criteria) (*LinkTracker, error) { + lts := &LinkTrackers{} + if err := c.SearchRead(LinkTrackerModel, criteria, NewOptions().Limit(1), lts); err != nil { + return nil, err + } + if lts != nil && len(*lts) > 0 { + return &((*lts)[0]), nil + } + return nil, fmt.Errorf("no link.tracker was found with criteria %v", criteria) +} + +// FindLinkTrackers finds link.tracker records by querying it +// and filtering it with criteria and options. +func (c *Client) FindLinkTrackers(criteria *Criteria, options *Options) (*LinkTrackers, error) { + lts := &LinkTrackers{} + if err := c.SearchRead(LinkTrackerModel, criteria, options, lts); err != nil { + return nil, err + } + return lts, nil +} + +// FindLinkTrackerIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindLinkTrackerIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(LinkTrackerModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindLinkTrackerId finds record id by querying it with criteria. +func (c *Client) FindLinkTrackerId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(LinkTrackerModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no link.tracker was found with criteria %v and options %v", criteria, options) +} diff --git a/link_tracker_click.go b/link_tracker_click.go new file mode 100644 index 00000000..f0b24e23 --- /dev/null +++ b/link_tracker_click.go @@ -0,0 +1,125 @@ +package odoo + +import ( + "fmt" +) + +// LinkTrackerClick represents link.tracker.click model. +type LinkTrackerClick struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + ClickDate *Time `xmlrpc:"click_date,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"` + Ip *String `xmlrpc:"ip,omitempty"` + LinkId *Many2One `xmlrpc:"link_id,omitempty"` + MailStatId *Many2One `xmlrpc:"mail_stat_id,omitempty"` + MassMailingCampaignId *Many2One `xmlrpc:"mass_mailing_campaign_id,omitempty"` + MassMailingId *Many2One `xmlrpc:"mass_mailing_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// LinkTrackerClicks represents array of link.tracker.click model. +type LinkTrackerClicks []LinkTrackerClick + +// LinkTrackerClickModel is the odoo model name. +const LinkTrackerClickModel = "link.tracker.click" + +// Many2One convert LinkTrackerClick to *Many2One. +func (ltc *LinkTrackerClick) Many2One() *Many2One { + return NewMany2One(ltc.Id.Get(), "") +} + +// CreateLinkTrackerClick creates a new link.tracker.click model and returns its id. +func (c *Client) CreateLinkTrackerClick(ltc *LinkTrackerClick) (int64, error) { + return c.Create(LinkTrackerClickModel, ltc) +} + +// UpdateLinkTrackerClick updates an existing link.tracker.click record. +func (c *Client) UpdateLinkTrackerClick(ltc *LinkTrackerClick) error { + return c.UpdateLinkTrackerClicks([]int64{ltc.Id.Get()}, ltc) +} + +// UpdateLinkTrackerClicks updates existing link.tracker.click records. +// All records (represented by ids) will be updated by ltc values. +func (c *Client) UpdateLinkTrackerClicks(ids []int64, ltc *LinkTrackerClick) error { + return c.Update(LinkTrackerClickModel, ids, ltc) +} + +// DeleteLinkTrackerClick deletes an existing link.tracker.click record. +func (c *Client) DeleteLinkTrackerClick(id int64) error { + return c.DeleteLinkTrackerClicks([]int64{id}) +} + +// DeleteLinkTrackerClicks deletes existing link.tracker.click records. +func (c *Client) DeleteLinkTrackerClicks(ids []int64) error { + return c.Delete(LinkTrackerClickModel, ids) +} + +// GetLinkTrackerClick gets link.tracker.click existing record. +func (c *Client) GetLinkTrackerClick(id int64) (*LinkTrackerClick, error) { + ltcs, err := c.GetLinkTrackerClicks([]int64{id}) + if err != nil { + return nil, err + } + if ltcs != nil && len(*ltcs) > 0 { + return &((*ltcs)[0]), nil + } + return nil, fmt.Errorf("id %v of link.tracker.click not found", id) +} + +// GetLinkTrackerClicks gets link.tracker.click existing records. +func (c *Client) GetLinkTrackerClicks(ids []int64) (*LinkTrackerClicks, error) { + ltcs := &LinkTrackerClicks{} + if err := c.Read(LinkTrackerClickModel, ids, nil, ltcs); err != nil { + return nil, err + } + return ltcs, nil +} + +// FindLinkTrackerClick finds link.tracker.click record by querying it with criteria. +func (c *Client) FindLinkTrackerClick(criteria *Criteria) (*LinkTrackerClick, error) { + ltcs := &LinkTrackerClicks{} + if err := c.SearchRead(LinkTrackerClickModel, criteria, NewOptions().Limit(1), ltcs); err != nil { + return nil, err + } + if ltcs != nil && len(*ltcs) > 0 { + return &((*ltcs)[0]), nil + } + return nil, fmt.Errorf("no link.tracker.click was found with criteria %v", criteria) +} + +// FindLinkTrackerClicks finds link.tracker.click records by querying it +// and filtering it with criteria and options. +func (c *Client) FindLinkTrackerClicks(criteria *Criteria, options *Options) (*LinkTrackerClicks, error) { + ltcs := &LinkTrackerClicks{} + if err := c.SearchRead(LinkTrackerClickModel, criteria, options, ltcs); err != nil { + return nil, err + } + return ltcs, nil +} + +// FindLinkTrackerClickIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindLinkTrackerClickIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(LinkTrackerClickModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindLinkTrackerClickId finds record id by querying it with criteria. +func (c *Client) FindLinkTrackerClickId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(LinkTrackerClickModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no link.tracker.click was found with criteria %v and options %v", criteria, options) +} diff --git a/link_tracker_code.go b/link_tracker_code.go new file mode 100644 index 00000000..1ab25d67 --- /dev/null +++ b/link_tracker_code.go @@ -0,0 +1,120 @@ +package odoo + +import ( + "fmt" +) + +// LinkTrackerCode represents link.tracker.code model. +type LinkTrackerCode struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` + LinkId *Many2One `xmlrpc:"link_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// LinkTrackerCodes represents array of link.tracker.code model. +type LinkTrackerCodes []LinkTrackerCode + +// LinkTrackerCodeModel is the odoo model name. +const LinkTrackerCodeModel = "link.tracker.code" + +// Many2One convert LinkTrackerCode to *Many2One. +func (ltc *LinkTrackerCode) Many2One() *Many2One { + return NewMany2One(ltc.Id.Get(), "") +} + +// CreateLinkTrackerCode creates a new link.tracker.code model and returns its id. +func (c *Client) CreateLinkTrackerCode(ltc *LinkTrackerCode) (int64, error) { + return c.Create(LinkTrackerCodeModel, ltc) +} + +// UpdateLinkTrackerCode updates an existing link.tracker.code record. +func (c *Client) UpdateLinkTrackerCode(ltc *LinkTrackerCode) error { + return c.UpdateLinkTrackerCodes([]int64{ltc.Id.Get()}, ltc) +} + +// UpdateLinkTrackerCodes updates existing link.tracker.code records. +// All records (represented by ids) will be updated by ltc values. +func (c *Client) UpdateLinkTrackerCodes(ids []int64, ltc *LinkTrackerCode) error { + return c.Update(LinkTrackerCodeModel, ids, ltc) +} + +// DeleteLinkTrackerCode deletes an existing link.tracker.code record. +func (c *Client) DeleteLinkTrackerCode(id int64) error { + return c.DeleteLinkTrackerCodes([]int64{id}) +} + +// DeleteLinkTrackerCodes deletes existing link.tracker.code records. +func (c *Client) DeleteLinkTrackerCodes(ids []int64) error { + return c.Delete(LinkTrackerCodeModel, ids) +} + +// GetLinkTrackerCode gets link.tracker.code existing record. +func (c *Client) GetLinkTrackerCode(id int64) (*LinkTrackerCode, error) { + ltcs, err := c.GetLinkTrackerCodes([]int64{id}) + if err != nil { + return nil, err + } + if ltcs != nil && len(*ltcs) > 0 { + return &((*ltcs)[0]), nil + } + return nil, fmt.Errorf("id %v of link.tracker.code not found", id) +} + +// GetLinkTrackerCodes gets link.tracker.code existing records. +func (c *Client) GetLinkTrackerCodes(ids []int64) (*LinkTrackerCodes, error) { + ltcs := &LinkTrackerCodes{} + if err := c.Read(LinkTrackerCodeModel, ids, nil, ltcs); err != nil { + return nil, err + } + return ltcs, nil +} + +// FindLinkTrackerCode finds link.tracker.code record by querying it with criteria. +func (c *Client) FindLinkTrackerCode(criteria *Criteria) (*LinkTrackerCode, error) { + ltcs := &LinkTrackerCodes{} + if err := c.SearchRead(LinkTrackerCodeModel, criteria, NewOptions().Limit(1), ltcs); err != nil { + return nil, err + } + if ltcs != nil && len(*ltcs) > 0 { + return &((*ltcs)[0]), nil + } + return nil, fmt.Errorf("no link.tracker.code was found with criteria %v", criteria) +} + +// FindLinkTrackerCodes finds link.tracker.code records by querying it +// and filtering it with criteria and options. +func (c *Client) FindLinkTrackerCodes(criteria *Criteria, options *Options) (*LinkTrackerCodes, error) { + ltcs := &LinkTrackerCodes{} + if err := c.SearchRead(LinkTrackerCodeModel, criteria, options, ltcs); err != nil { + return nil, err + } + return ltcs, nil +} + +// FindLinkTrackerCodeIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindLinkTrackerCodeIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(LinkTrackerCodeModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindLinkTrackerCodeId finds record id by querying it with criteria. +func (c *Client) FindLinkTrackerCodeId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(LinkTrackerCodeModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no link.tracker.code was found with criteria %v and options %v", criteria, options) +} diff --git a/mail_activity.go b/mail_activity.go new file mode 100644 index 00000000..15ae52bc --- /dev/null +++ b/mail_activity.go @@ -0,0 +1,135 @@ +package odoo + +import ( + "fmt" +) + +// MailActivity represents mail.activity model. +type MailActivity struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + ActivityCategory *Selection `xmlrpc:"activity_category,omitempty"` + ActivityTypeId *Many2One `xmlrpc:"activity_type_id,omitempty"` + CalendarEventId *Many2One `xmlrpc:"calendar_event_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DateDeadline *Time `xmlrpc:"date_deadline,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Feedback *String `xmlrpc:"feedback,omitempty"` + HasRecommendedActivities *Bool `xmlrpc:"has_recommended_activities,omitempty"` + Icon *String `xmlrpc:"icon,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Note *String `xmlrpc:"note,omitempty"` + PreviousActivityTypeId *Many2One `xmlrpc:"previous_activity_type_id,omitempty"` + RecommendedActivityTypeId *Many2One `xmlrpc:"recommended_activity_type_id,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"` + State *Selection `xmlrpc:"state,omitempty"` + Summary *String `xmlrpc:"summary,omitempty"` + UserId *Many2One `xmlrpc:"user_id,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) { + return c.Create(MailActivityModel, ma) +} + +// 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) +} + +// 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 + } + if mas != nil && len(*mas) > 0 { + return &((*mas)[0]), nil + } + return nil, fmt.Errorf("id %v of mail.activity not found", id) +} + +// 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 + } + if mas != nil && len(*mas) > 0 { + return &((*mas)[0]), nil + } + return nil, fmt.Errorf("no mail.activity was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(MailActivityModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no mail.activity was found with criteria %v and options %v", criteria, options) +} diff --git a/mail_activity_mixin.go b/mail_activity_mixin.go new file mode 100644 index 00000000..df885909 --- /dev/null +++ b/mail_activity_mixin.go @@ -0,0 +1,120 @@ +package odoo + +import ( + "fmt" +) + +// MailActivityMixin represents mail.activity.mixin model. +type MailActivityMixin struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + ActivityDateDeadline *Time `xmlrpc:"activity_date_deadline,omitempty"` + ActivityIds *Relation `xmlrpc:"activity_ids,omitempty"` + ActivityState *Selection `xmlrpc:"activity_state,omitempty"` + ActivitySummary *String `xmlrpc:"activity_summary,omitempty"` + ActivityTypeId *Many2One `xmlrpc:"activity_type_id,omitempty"` + ActivityUserId *Many2One `xmlrpc:"activity_user_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` +} + +// MailActivityMixins represents array of mail.activity.mixin model. +type MailActivityMixins []MailActivityMixin + +// MailActivityMixinModel is the odoo model name. +const MailActivityMixinModel = "mail.activity.mixin" + +// Many2One convert MailActivityMixin to *Many2One. +func (mam *MailActivityMixin) Many2One() *Many2One { + return NewMany2One(mam.Id.Get(), "") +} + +// CreateMailActivityMixin creates a new mail.activity.mixin model and returns its id. +func (c *Client) CreateMailActivityMixin(mam *MailActivityMixin) (int64, error) { + return c.Create(MailActivityMixinModel, mam) +} + +// UpdateMailActivityMixin updates an existing mail.activity.mixin record. +func (c *Client) UpdateMailActivityMixin(mam *MailActivityMixin) error { + return c.UpdateMailActivityMixins([]int64{mam.Id.Get()}, mam) +} + +// UpdateMailActivityMixins updates existing mail.activity.mixin records. +// All records (represented by ids) will be updated by mam values. +func (c *Client) UpdateMailActivityMixins(ids []int64, mam *MailActivityMixin) error { + return c.Update(MailActivityMixinModel, ids, mam) +} + +// DeleteMailActivityMixin deletes an existing mail.activity.mixin record. +func (c *Client) DeleteMailActivityMixin(id int64) error { + return c.DeleteMailActivityMixins([]int64{id}) +} + +// DeleteMailActivityMixins deletes existing mail.activity.mixin records. +func (c *Client) DeleteMailActivityMixins(ids []int64) error { + return c.Delete(MailActivityMixinModel, ids) +} + +// GetMailActivityMixin gets mail.activity.mixin existing record. +func (c *Client) GetMailActivityMixin(id int64) (*MailActivityMixin, error) { + mams, err := c.GetMailActivityMixins([]int64{id}) + if err != nil { + return nil, err + } + if mams != nil && len(*mams) > 0 { + return &((*mams)[0]), nil + } + return nil, fmt.Errorf("id %v of mail.activity.mixin not found", id) +} + +// GetMailActivityMixins gets mail.activity.mixin existing records. +func (c *Client) GetMailActivityMixins(ids []int64) (*MailActivityMixins, error) { + mams := &MailActivityMixins{} + if err := c.Read(MailActivityMixinModel, ids, nil, mams); err != nil { + return nil, err + } + return mams, nil +} + +// FindMailActivityMixin finds mail.activity.mixin record by querying it with criteria. +func (c *Client) FindMailActivityMixin(criteria *Criteria) (*MailActivityMixin, error) { + mams := &MailActivityMixins{} + if err := c.SearchRead(MailActivityMixinModel, criteria, NewOptions().Limit(1), mams); err != nil { + return nil, err + } + if mams != nil && len(*mams) > 0 { + return &((*mams)[0]), nil + } + return nil, fmt.Errorf("no mail.activity.mixin was found with criteria %v", criteria) +} + +// FindMailActivityMixins finds mail.activity.mixin records by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailActivityMixins(criteria *Criteria, options *Options) (*MailActivityMixins, error) { + mams := &MailActivityMixins{} + if err := c.SearchRead(MailActivityMixinModel, criteria, options, mams); err != nil { + return nil, err + } + return mams, nil +} + +// FindMailActivityMixinIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailActivityMixinIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(MailActivityMixinModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindMailActivityMixinId finds record id by querying it with criteria. +func (c *Client) FindMailActivityMixinId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(MailActivityMixinModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no mail.activity.mixin was found with criteria %v and options %v", criteria, options) +} diff --git a/mail_activity_type.go b/mail_activity_type.go new file mode 100644 index 00000000..ac18db15 --- /dev/null +++ b/mail_activity_type.go @@ -0,0 +1,127 @@ +package odoo + +import ( + "fmt" +) + +// MailActivityType represents mail.activity.type model. +type MailActivityType struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + Category *Selection `xmlrpc:"category,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Days *Int `xmlrpc:"days,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Icon *String `xmlrpc:"icon,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + NextTypeIds *Relation `xmlrpc:"next_type_ids,omitempty"` + PreviousTypeIds *Relation `xmlrpc:"previous_type_ids,omitempty"` + ResModelId *Many2One `xmlrpc:"res_model_id,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + Summary *String `xmlrpc:"summary,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) { + return c.Create(MailActivityTypeModel, mat) +} + +// 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) +} + +// 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 + } + if mats != nil && len(*mats) > 0 { + return &((*mats)[0]), nil + } + return nil, fmt.Errorf("id %v of mail.activity.type not found", id) +} + +// 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 + } + if mats != nil && len(*mats) > 0 { + return &((*mats)[0]), nil + } + return nil, fmt.Errorf("no mail.activity.type was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(MailActivityTypeModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no mail.activity.type was found with criteria %v and options %v", criteria, options) +} diff --git a/mail_alias.go b/mail_alias.go new file mode 100644 index 00000000..9998bf21 --- /dev/null +++ b/mail_alias.go @@ -0,0 +1,127 @@ +package odoo + +import ( + "fmt" +) + +// MailAlias represents mail.alias model. +type MailAlias struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AliasContact *Selection `xmlrpc:"alias_contact,omitempty"` + AliasDefaults *String `xmlrpc:"alias_defaults,omitempty"` + AliasDomain *String `xmlrpc:"alias_domain,omitempty"` + AliasForceThreadId *Int `xmlrpc:"alias_force_thread_id,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"` + AliasUserId *Many2One `xmlrpc:"alias_user_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"` +} + +// 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) { + return c.Create(MailAliasModel, ma) +} + +// 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) +} + +// 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 + } + if mas != nil && len(*mas) > 0 { + return &((*mas)[0]), nil + } + return nil, fmt.Errorf("id %v of mail.alias not found", id) +} + +// 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 + } + if mas != nil && len(*mas) > 0 { + return &((*mas)[0]), nil + } + return nil, fmt.Errorf("no mail.alias was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(MailAliasModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no mail.alias was found with criteria %v and options %v", criteria, options) +} diff --git a/mail_alias_mixin.go b/mail_alias_mixin.go new file mode 100644 index 00000000..c968a30a --- /dev/null +++ b/mail_alias_mixin.go @@ -0,0 +1,128 @@ +package odoo + +import ( + "fmt" +) + +// MailAliasMixin represents mail.alias.mixin model. +type MailAliasMixin struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AliasContact *Selection `xmlrpc:"alias_contact,omitempty"` + AliasDefaults *String `xmlrpc:"alias_defaults,omitempty"` + AliasDomain *String `xmlrpc:"alias_domain,omitempty"` + AliasForceThreadId *Int `xmlrpc:"alias_force_thread_id,omitempty"` + AliasId *Many2One `xmlrpc:"alias_id,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"` + AliasUserId *Many2One `xmlrpc:"alias_user_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"` +} + +// MailAliasMixins represents array of mail.alias.mixin model. +type MailAliasMixins []MailAliasMixin + +// MailAliasMixinModel is the odoo model name. +const MailAliasMixinModel = "mail.alias.mixin" + +// Many2One convert MailAliasMixin to *Many2One. +func (mam *MailAliasMixin) Many2One() *Many2One { + return NewMany2One(mam.Id.Get(), "") +} + +// CreateMailAliasMixin creates a new mail.alias.mixin model and returns its id. +func (c *Client) CreateMailAliasMixin(mam *MailAliasMixin) (int64, error) { + return c.Create(MailAliasMixinModel, mam) +} + +// UpdateMailAliasMixin updates an existing mail.alias.mixin record. +func (c *Client) UpdateMailAliasMixin(mam *MailAliasMixin) error { + return c.UpdateMailAliasMixins([]int64{mam.Id.Get()}, mam) +} + +// UpdateMailAliasMixins updates existing mail.alias.mixin records. +// All records (represented by ids) will be updated by mam values. +func (c *Client) UpdateMailAliasMixins(ids []int64, mam *MailAliasMixin) error { + return c.Update(MailAliasMixinModel, ids, mam) +} + +// DeleteMailAliasMixin deletes an existing mail.alias.mixin record. +func (c *Client) DeleteMailAliasMixin(id int64) error { + return c.DeleteMailAliasMixins([]int64{id}) +} + +// DeleteMailAliasMixins deletes existing mail.alias.mixin records. +func (c *Client) DeleteMailAliasMixins(ids []int64) error { + return c.Delete(MailAliasMixinModel, ids) +} + +// GetMailAliasMixin gets mail.alias.mixin existing record. +func (c *Client) GetMailAliasMixin(id int64) (*MailAliasMixin, error) { + mams, err := c.GetMailAliasMixins([]int64{id}) + if err != nil { + return nil, err + } + if mams != nil && len(*mams) > 0 { + return &((*mams)[0]), nil + } + return nil, fmt.Errorf("id %v of mail.alias.mixin not found", id) +} + +// GetMailAliasMixins gets mail.alias.mixin existing records. +func (c *Client) GetMailAliasMixins(ids []int64) (*MailAliasMixins, error) { + mams := &MailAliasMixins{} + if err := c.Read(MailAliasMixinModel, ids, nil, mams); err != nil { + return nil, err + } + return mams, nil +} + +// FindMailAliasMixin finds mail.alias.mixin record by querying it with criteria. +func (c *Client) FindMailAliasMixin(criteria *Criteria) (*MailAliasMixin, error) { + mams := &MailAliasMixins{} + if err := c.SearchRead(MailAliasMixinModel, criteria, NewOptions().Limit(1), mams); err != nil { + return nil, err + } + if mams != nil && len(*mams) > 0 { + return &((*mams)[0]), nil + } + return nil, fmt.Errorf("no mail.alias.mixin was found with criteria %v", criteria) +} + +// FindMailAliasMixins finds mail.alias.mixin records by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailAliasMixins(criteria *Criteria, options *Options) (*MailAliasMixins, error) { + mams := &MailAliasMixins{} + if err := c.SearchRead(MailAliasMixinModel, criteria, options, mams); err != nil { + return nil, err + } + return mams, nil +} + +// FindMailAliasMixinIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailAliasMixinIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(MailAliasMixinModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindMailAliasMixinId finds record id by querying it with criteria. +func (c *Client) FindMailAliasMixinId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(MailAliasMixinModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no mail.alias.mixin was found with criteria %v and options %v", criteria, options) +} diff --git a/mail_channel.go b/mail_channel.go new file mode 100644 index 00000000..f35c8b94 --- /dev/null +++ b/mail_channel.go @@ -0,0 +1,162 @@ +package odoo + +import ( + "fmt" +) + +// MailChannel represents mail.channel model. +type MailChannel struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AliasContact *Selection `xmlrpc:"alias_contact,omitempty"` + AliasDefaults *String `xmlrpc:"alias_defaults,omitempty"` + AliasDomain *String `xmlrpc:"alias_domain,omitempty"` + AliasForceThreadId *Int `xmlrpc:"alias_force_thread_id,omitempty"` + AliasId *Many2One `xmlrpc:"alias_id,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"` + AliasUserId *Many2One `xmlrpc:"alias_user_id,omitempty"` + AnonymousName *String `xmlrpc:"anonymous_name,omitempty"` + ChannelLastSeenPartnerIds *Relation `xmlrpc:"channel_last_seen_partner_ids,omitempty"` + ChannelMessageIds *Relation `xmlrpc:"channel_message_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"` + Description *String `xmlrpc:"description,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + EmailSend *Bool `xmlrpc:"email_send,omitempty"` + GroupIds *Relation `xmlrpc:"group_ids,omitempty"` + GroupPublicId *Many2One `xmlrpc:"group_public_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Image *String `xmlrpc:"image,omitempty"` + ImageMedium *String `xmlrpc:"image_medium,omitempty"` + ImageSmall *String `xmlrpc:"image_small,omitempty"` + IsMember *Bool `xmlrpc:"is_member,omitempty"` + IsSubscribed *Bool `xmlrpc:"is_subscribed,omitempty"` + LivechatChannelId *Many2One `xmlrpc:"livechat_channel_id,omitempty"` + MessageChannelIds *Relation `xmlrpc:"message_channel_ids,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageLastPost *Time `xmlrpc:"message_last_post,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MessageUnread *Bool `xmlrpc:"message_unread,omitempty"` + MessageUnreadCounter *Int `xmlrpc:"message_unread_counter,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Public *Selection `xmlrpc:"public,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"` + RatingLastValue *Float `xmlrpc:"rating_last_value,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"` +} + +// MailChannels represents array of mail.channel model. +type MailChannels []MailChannel + +// MailChannelModel is the odoo model name. +const MailChannelModel = "mail.channel" + +// Many2One convert MailChannel to *Many2One. +func (mc *MailChannel) Many2One() *Many2One { + return NewMany2One(mc.Id.Get(), "") +} + +// CreateMailChannel creates a new mail.channel model and returns its id. +func (c *Client) CreateMailChannel(mc *MailChannel) (int64, error) { + return c.Create(MailChannelModel, mc) +} + +// UpdateMailChannel updates an existing mail.channel record. +func (c *Client) UpdateMailChannel(mc *MailChannel) error { + return c.UpdateMailChannels([]int64{mc.Id.Get()}, mc) +} + +// UpdateMailChannels updates existing mail.channel records. +// All records (represented by ids) will be updated by mc values. +func (c *Client) UpdateMailChannels(ids []int64, mc *MailChannel) error { + return c.Update(MailChannelModel, ids, mc) +} + +// DeleteMailChannel deletes an existing mail.channel record. +func (c *Client) DeleteMailChannel(id int64) error { + return c.DeleteMailChannels([]int64{id}) +} + +// DeleteMailChannels deletes existing mail.channel records. +func (c *Client) DeleteMailChannels(ids []int64) error { + return c.Delete(MailChannelModel, ids) +} + +// GetMailChannel gets mail.channel existing record. +func (c *Client) GetMailChannel(id int64) (*MailChannel, error) { + mcs, err := c.GetMailChannels([]int64{id}) + if err != nil { + return nil, err + } + if mcs != nil && len(*mcs) > 0 { + return &((*mcs)[0]), nil + } + return nil, fmt.Errorf("id %v of mail.channel not found", id) +} + +// GetMailChannels gets mail.channel existing records. +func (c *Client) GetMailChannels(ids []int64) (*MailChannels, error) { + mcs := &MailChannels{} + if err := c.Read(MailChannelModel, ids, nil, mcs); err != nil { + return nil, err + } + return mcs, nil +} + +// FindMailChannel finds mail.channel record by querying it with criteria. +func (c *Client) FindMailChannel(criteria *Criteria) (*MailChannel, error) { + mcs := &MailChannels{} + if err := c.SearchRead(MailChannelModel, criteria, NewOptions().Limit(1), mcs); err != nil { + return nil, err + } + if mcs != nil && len(*mcs) > 0 { + return &((*mcs)[0]), nil + } + return nil, fmt.Errorf("no mail.channel was found with criteria %v", criteria) +} + +// FindMailChannels finds mail.channel records by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailChannels(criteria *Criteria, options *Options) (*MailChannels, error) { + mcs := &MailChannels{} + if err := c.SearchRead(MailChannelModel, criteria, options, mcs); err != nil { + return nil, err + } + return mcs, nil +} + +// FindMailChannelIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailChannelIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(MailChannelModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindMailChannelId finds record id by querying it with criteria. +func (c *Client) FindMailChannelId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(MailChannelModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no mail.channel was found with criteria %v and options %v", criteria, options) +} diff --git a/mail_channel_partner.go b/mail_channel_partner.go new file mode 100644 index 00000000..1f313935 --- /dev/null +++ b/mail_channel_partner.go @@ -0,0 +1,125 @@ +package odoo + +import ( + "fmt" +) + +// MailChannelPartner represents mail.channel.partner model. +type MailChannelPartner struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + ChannelId *Many2One `xmlrpc:"channel_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + FoldState *Selection `xmlrpc:"fold_state,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsMinimized *Bool `xmlrpc:"is_minimized,omitempty"` + IsPinned *Bool `xmlrpc:"is_pinned,omitempty"` + PartnerEmail *String `xmlrpc:"partner_email,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + SeenMessageId *Many2One `xmlrpc:"seen_message_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// MailChannelPartners represents array of mail.channel.partner model. +type MailChannelPartners []MailChannelPartner + +// MailChannelPartnerModel is the odoo model name. +const MailChannelPartnerModel = "mail.channel.partner" + +// Many2One convert MailChannelPartner to *Many2One. +func (mcp *MailChannelPartner) Many2One() *Many2One { + return NewMany2One(mcp.Id.Get(), "") +} + +// CreateMailChannelPartner creates a new mail.channel.partner model and returns its id. +func (c *Client) CreateMailChannelPartner(mcp *MailChannelPartner) (int64, error) { + return c.Create(MailChannelPartnerModel, mcp) +} + +// UpdateMailChannelPartner updates an existing mail.channel.partner record. +func (c *Client) UpdateMailChannelPartner(mcp *MailChannelPartner) error { + return c.UpdateMailChannelPartners([]int64{mcp.Id.Get()}, mcp) +} + +// UpdateMailChannelPartners updates existing mail.channel.partner records. +// All records (represented by ids) will be updated by mcp values. +func (c *Client) UpdateMailChannelPartners(ids []int64, mcp *MailChannelPartner) error { + return c.Update(MailChannelPartnerModel, ids, mcp) +} + +// DeleteMailChannelPartner deletes an existing mail.channel.partner record. +func (c *Client) DeleteMailChannelPartner(id int64) error { + return c.DeleteMailChannelPartners([]int64{id}) +} + +// DeleteMailChannelPartners deletes existing mail.channel.partner records. +func (c *Client) DeleteMailChannelPartners(ids []int64) error { + return c.Delete(MailChannelPartnerModel, ids) +} + +// GetMailChannelPartner gets mail.channel.partner existing record. +func (c *Client) GetMailChannelPartner(id int64) (*MailChannelPartner, error) { + mcps, err := c.GetMailChannelPartners([]int64{id}) + if err != nil { + return nil, err + } + if mcps != nil && len(*mcps) > 0 { + return &((*mcps)[0]), nil + } + return nil, fmt.Errorf("id %v of mail.channel.partner not found", id) +} + +// GetMailChannelPartners gets mail.channel.partner existing records. +func (c *Client) GetMailChannelPartners(ids []int64) (*MailChannelPartners, error) { + mcps := &MailChannelPartners{} + if err := c.Read(MailChannelPartnerModel, ids, nil, mcps); err != nil { + return nil, err + } + return mcps, nil +} + +// FindMailChannelPartner finds mail.channel.partner record by querying it with criteria. +func (c *Client) FindMailChannelPartner(criteria *Criteria) (*MailChannelPartner, error) { + mcps := &MailChannelPartners{} + if err := c.SearchRead(MailChannelPartnerModel, criteria, NewOptions().Limit(1), mcps); err != nil { + return nil, err + } + if mcps != nil && len(*mcps) > 0 { + return &((*mcps)[0]), nil + } + return nil, fmt.Errorf("no mail.channel.partner was found with criteria %v", criteria) +} + +// FindMailChannelPartners finds mail.channel.partner records by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailChannelPartners(criteria *Criteria, options *Options) (*MailChannelPartners, error) { + mcps := &MailChannelPartners{} + if err := c.SearchRead(MailChannelPartnerModel, criteria, options, mcps); err != nil { + return nil, err + } + return mcps, nil +} + +// FindMailChannelPartnerIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailChannelPartnerIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(MailChannelPartnerModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindMailChannelPartnerId finds record id by querying it with criteria. +func (c *Client) FindMailChannelPartnerId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(MailChannelPartnerModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no mail.channel.partner was found with criteria %v and options %v", criteria, options) +} diff --git a/mail_compose_message.go b/mail_compose_message.go new file mode 100644 index 00000000..118955e7 --- /dev/null +++ b/mail_compose_message.go @@ -0,0 +1,159 @@ +package odoo + +import ( + "fmt" +) + +// MailComposeMessage represents mail.compose.message model. +type MailComposeMessage struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + ActiveDomain *String `xmlrpc:"active_domain,omitempty"` + AttachmentIds *Relation `xmlrpc:"attachment_ids,omitempty"` + AuthorAvatar *String `xmlrpc:"author_avatar,omitempty"` + AuthorId *Many2One `xmlrpc:"author_id,omitempty"` + AutoDelete *Bool `xmlrpc:"auto_delete,omitempty"` + AutoDeleteMessage *Bool `xmlrpc:"auto_delete_message,omitempty"` + Body *String `xmlrpc:"body,omitempty"` + ChannelIds *Relation `xmlrpc:"channel_ids,omitempty"` + ChildIds *Relation `xmlrpc:"child_ids,omitempty"` + CompositionMode *Selection `xmlrpc:"composition_mode,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Date *Time `xmlrpc:"date,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + EmailFrom *String `xmlrpc:"email_from,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsLog *Bool `xmlrpc:"is_log,omitempty"` + MailActivityTypeId *Many2One `xmlrpc:"mail_activity_type_id,omitempty"` + MailServerId *Many2One `xmlrpc:"mail_server_id,omitempty"` + MailingListIds *Relation `xmlrpc:"mailing_list_ids,omitempty"` + MassMailingCampaignId *Many2One `xmlrpc:"mass_mailing_campaign_id,omitempty"` + MassMailingId *Many2One `xmlrpc:"mass_mailing_id,omitempty"` + MassMailingName *String `xmlrpc:"mass_mailing_name,omitempty"` + MessageId *String `xmlrpc:"message_id,omitempty"` + MessageType *Selection `xmlrpc:"message_type,omitempty"` + Model *String `xmlrpc:"model,omitempty"` + Needaction *Bool `xmlrpc:"needaction,omitempty"` + NeedactionPartnerIds *Relation `xmlrpc:"needaction_partner_ids,omitempty"` + NoAutoThread *Bool `xmlrpc:"no_auto_thread,omitempty"` + NotificationIds *Relation `xmlrpc:"notification_ids,omitempty"` + Notify *Bool `xmlrpc:"notify,omitempty"` + ParentId *Many2One `xmlrpc:"parent_id,omitempty"` + PartnerIds *Relation `xmlrpc:"partner_ids,omitempty"` + RatingIds *Relation `xmlrpc:"rating_ids,omitempty"` + RatingValue *Float `xmlrpc:"rating_value,omitempty"` + RecordName *String `xmlrpc:"record_name,omitempty"` + ReplyTo *String `xmlrpc:"reply_to,omitempty"` + ResId *Int `xmlrpc:"res_id,omitempty"` + Starred *Bool `xmlrpc:"starred,omitempty"` + StarredPartnerIds *Relation `xmlrpc:"starred_partner_ids,omitempty"` + Subject *String `xmlrpc:"subject,omitempty"` + SubtypeId *Many2One `xmlrpc:"subtype_id,omitempty"` + TemplateId *Many2One `xmlrpc:"template_id,omitempty"` + TrackingValueIds *Relation `xmlrpc:"tracking_value_ids,omitempty"` + UseActiveDomain *Bool `xmlrpc:"use_active_domain,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) { + return c.Create(MailComposeMessageModel, mcm) +} + +// 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) +} + +// 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 + } + if mcms != nil && len(*mcms) > 0 { + return &((*mcms)[0]), nil + } + return nil, fmt.Errorf("id %v of mail.compose.message not found", id) +} + +// 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 + } + if mcms != nil && len(*mcms) > 0 { + return &((*mcms)[0]), nil + } + return nil, fmt.Errorf("no mail.compose.message was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(MailComposeMessageModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no mail.compose.message was found with criteria %v and options %v", criteria, options) +} diff --git a/mail_followers.go b/mail_followers.go index 49639430..44cc57fb 100644 --- a/mail_followers.go +++ b/mail_followers.go @@ -83,7 +83,7 @@ func (c *Client) FindMailFollowers(criteria *Criteria) (*MailFollowers, error) { if mfs != nil && len(*mfs) > 0 { return &((*mfs)[0]), nil } - return nil, fmt.Errorf("mail.followers was not found") + return nil, fmt.Errorf("no mail.followers was found with criteria %v", criteria) } // FindMailFollowerss finds mail.followers records by querying it @@ -115,5 +115,5 @@ func (c *Client) FindMailFollowersId(criteria *Criteria, options *Options) (int6 if len(ids) > 0 { return ids[0], nil } - return -1, fmt.Errorf("mail.followers was not found") + return -1, fmt.Errorf("no mail.followers was found with criteria %v and options %v", criteria, options) } diff --git a/mail_mail.go b/mail_mail.go new file mode 100644 index 00000000..f6a2fec9 --- /dev/null +++ b/mail_mail.go @@ -0,0 +1,162 @@ +package odoo + +import ( + "fmt" +) + +// MailMail represents mail.mail model. +type MailMail struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AttachmentIds *Relation `xmlrpc:"attachment_ids,omitempty"` + AuthorAvatar *String `xmlrpc:"author_avatar,omitempty"` + AuthorId *Many2One `xmlrpc:"author_id,omitempty"` + AutoDelete *Bool `xmlrpc:"auto_delete,omitempty"` + Body *String `xmlrpc:"body,omitempty"` + BodyHtml *String `xmlrpc:"body_html,omitempty"` + ChannelIds *Relation `xmlrpc:"channel_ids,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"` + EmailCc *String `xmlrpc:"email_cc,omitempty"` + EmailFrom *String `xmlrpc:"email_from,omitempty"` + EmailTo *String `xmlrpc:"email_to,omitempty"` + FailureReason *String `xmlrpc:"failure_reason,omitempty"` + FetchmailServerId *Many2One `xmlrpc:"fetchmail_server_id,omitempty"` + Headers *String `xmlrpc:"headers,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + MailActivityTypeId *Many2One `xmlrpc:"mail_activity_type_id,omitempty"` + MailMessageId *Many2One `xmlrpc:"mail_message_id,omitempty"` + MailServerId *Many2One `xmlrpc:"mail_server_id,omitempty"` + MailingId *Many2One `xmlrpc:"mailing_id,omitempty"` + MessageId *String `xmlrpc:"message_id,omitempty"` + MessageType *Selection `xmlrpc:"message_type,omitempty"` + Model *String `xmlrpc:"model,omitempty"` + Needaction *Bool `xmlrpc:"needaction,omitempty"` + NeedactionPartnerIds *Relation `xmlrpc:"needaction_partner_ids,omitempty"` + NoAutoThread *Bool `xmlrpc:"no_auto_thread,omitempty"` + Notification *Bool `xmlrpc:"notification,omitempty"` + NotificationIds *Relation `xmlrpc:"notification_ids,omitempty"` + ParentId *Many2One `xmlrpc:"parent_id,omitempty"` + PartnerIds *Relation `xmlrpc:"partner_ids,omitempty"` + RatingIds *Relation `xmlrpc:"rating_ids,omitempty"` + RatingValue *Float `xmlrpc:"rating_value,omitempty"` + RecipientIds *Relation `xmlrpc:"recipient_ids,omitempty"` + RecordName *String `xmlrpc:"record_name,omitempty"` + References *String `xmlrpc:"references,omitempty"` + ReplyTo *String `xmlrpc:"reply_to,omitempty"` + ResId *Int `xmlrpc:"res_id,omitempty"` + ScheduledDate *String `xmlrpc:"scheduled_date,omitempty"` + Starred *Bool `xmlrpc:"starred,omitempty"` + StarredPartnerIds *Relation `xmlrpc:"starred_partner_ids,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + StatisticsIds *Relation `xmlrpc:"statistics_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"` +} + +// 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) { + return c.Create(MailMailModel, mm) +} + +// 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) +} + +// 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 + } + if mms != nil && len(*mms) > 0 { + return &((*mms)[0]), nil + } + return nil, fmt.Errorf("id %v of mail.mail not found", id) +} + +// 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 + } + if mms != nil && len(*mms) > 0 { + return &((*mms)[0]), nil + } + return nil, fmt.Errorf("no mail.mail was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(MailMailModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no mail.mail was found with criteria %v and options %v", criteria, options) +} diff --git a/mail_mail_statistics.go b/mail_mail_statistics.go new file mode 100644 index 00000000..1d244f3c --- /dev/null +++ b/mail_mail_statistics.go @@ -0,0 +1,136 @@ +package odoo + +import ( + "fmt" +) + +// MailMailStatistics represents mail.mail.statistics model. +type MailMailStatistics struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + Bounced *Time `xmlrpc:"bounced,omitempty"` + Clicked *Time `xmlrpc:"clicked,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Exception *Time `xmlrpc:"exception,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LinksClickIds *Relation `xmlrpc:"links_click_ids,omitempty"` + MailMailId *Many2One `xmlrpc:"mail_mail_id,omitempty"` + MailMailIdInt *Int `xmlrpc:"mail_mail_id_int,omitempty"` + MassMailingCampaignId *Many2One `xmlrpc:"mass_mailing_campaign_id,omitempty"` + MassMailingId *Many2One `xmlrpc:"mass_mailing_id,omitempty"` + MessageId *String `xmlrpc:"message_id,omitempty"` + Model *String `xmlrpc:"model,omitempty"` + Opened *Time `xmlrpc:"opened,omitempty"` + Recipient *String `xmlrpc:"recipient,omitempty"` + Replied *Time `xmlrpc:"replied,omitempty"` + ResId *Int `xmlrpc:"res_id,omitempty"` + Scheduled *Time `xmlrpc:"scheduled,omitempty"` + Sent *Time `xmlrpc:"sent,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + StateUpdate *Time `xmlrpc:"state_update,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// MailMailStatisticss represents array of mail.mail.statistics model. +type MailMailStatisticss []MailMailStatistics + +// MailMailStatisticsModel is the odoo model name. +const MailMailStatisticsModel = "mail.mail.statistics" + +// Many2One convert MailMailStatistics to *Many2One. +func (mms *MailMailStatistics) Many2One() *Many2One { + return NewMany2One(mms.Id.Get(), "") +} + +// CreateMailMailStatistics creates a new mail.mail.statistics model and returns its id. +func (c *Client) CreateMailMailStatistics(mms *MailMailStatistics) (int64, error) { + return c.Create(MailMailStatisticsModel, mms) +} + +// UpdateMailMailStatistics updates an existing mail.mail.statistics record. +func (c *Client) UpdateMailMailStatistics(mms *MailMailStatistics) error { + return c.UpdateMailMailStatisticss([]int64{mms.Id.Get()}, mms) +} + +// UpdateMailMailStatisticss updates existing mail.mail.statistics records. +// All records (represented by ids) will be updated by mms values. +func (c *Client) UpdateMailMailStatisticss(ids []int64, mms *MailMailStatistics) error { + return c.Update(MailMailStatisticsModel, ids, mms) +} + +// DeleteMailMailStatistics deletes an existing mail.mail.statistics record. +func (c *Client) DeleteMailMailStatistics(id int64) error { + return c.DeleteMailMailStatisticss([]int64{id}) +} + +// DeleteMailMailStatisticss deletes existing mail.mail.statistics records. +func (c *Client) DeleteMailMailStatisticss(ids []int64) error { + return c.Delete(MailMailStatisticsModel, ids) +} + +// GetMailMailStatistics gets mail.mail.statistics existing record. +func (c *Client) GetMailMailStatistics(id int64) (*MailMailStatistics, error) { + mmss, err := c.GetMailMailStatisticss([]int64{id}) + if err != nil { + return nil, err + } + if mmss != nil && len(*mmss) > 0 { + return &((*mmss)[0]), nil + } + return nil, fmt.Errorf("id %v of mail.mail.statistics not found", id) +} + +// GetMailMailStatisticss gets mail.mail.statistics existing records. +func (c *Client) GetMailMailStatisticss(ids []int64) (*MailMailStatisticss, error) { + mmss := &MailMailStatisticss{} + if err := c.Read(MailMailStatisticsModel, ids, nil, mmss); err != nil { + return nil, err + } + return mmss, nil +} + +// FindMailMailStatistics finds mail.mail.statistics record by querying it with criteria. +func (c *Client) FindMailMailStatistics(criteria *Criteria) (*MailMailStatistics, error) { + mmss := &MailMailStatisticss{} + if err := c.SearchRead(MailMailStatisticsModel, criteria, NewOptions().Limit(1), mmss); err != nil { + return nil, err + } + if mmss != nil && len(*mmss) > 0 { + return &((*mmss)[0]), nil + } + return nil, fmt.Errorf("no mail.mail.statistics was found with criteria %v", criteria) +} + +// FindMailMailStatisticss finds mail.mail.statistics records by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailMailStatisticss(criteria *Criteria, options *Options) (*MailMailStatisticss, error) { + mmss := &MailMailStatisticss{} + if err := c.SearchRead(MailMailStatisticsModel, criteria, options, mmss); err != nil { + return nil, err + } + return mmss, nil +} + +// FindMailMailStatisticsIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailMailStatisticsIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(MailMailStatisticsModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindMailMailStatisticsId finds record id by querying it with criteria. +func (c *Client) FindMailMailStatisticsId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(MailMailStatisticsModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no mail.mail.statistics was found with criteria %v and options %v", criteria, options) +} diff --git a/mail_mass_mailing.go b/mail_mass_mailing.go new file mode 100644 index 00000000..42c134ed --- /dev/null +++ b/mail_mass_mailing.go @@ -0,0 +1,155 @@ +package odoo + +import ( + "fmt" +) + +// MailMassMailing represents mail.mass_mailing model. +type MailMassMailing struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + Active *Bool `xmlrpc:"active,omitempty"` + AttachmentIds *Relation `xmlrpc:"attachment_ids,omitempty"` + BodyHtml *String `xmlrpc:"body_html,omitempty"` + Bounced *Int `xmlrpc:"bounced,omitempty"` + BouncedRatio *Int `xmlrpc:"bounced_ratio,omitempty"` + CampaignId *Many2One `xmlrpc:"campaign_id,omitempty"` + ClicksRatio *Int `xmlrpc:"clicks_ratio,omitempty"` + Color *Int `xmlrpc:"color,omitempty"` + ContactAbPc *Int `xmlrpc:"contact_ab_pc,omitempty"` + ContactListIds *Relation `xmlrpc:"contact_list_ids,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Delivered *Int `xmlrpc:"delivered,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + EmailFrom *String `xmlrpc:"email_from,omitempty"` + Failed *Int `xmlrpc:"failed,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + KeepArchives *Bool `xmlrpc:"keep_archives,omitempty"` + MailingDomain *String `xmlrpc:"mailing_domain,omitempty"` + MailingModelId *Many2One `xmlrpc:"mailing_model_id,omitempty"` + MailingModelName *String `xmlrpc:"mailing_model_name,omitempty"` + MailingModelReal *String `xmlrpc:"mailing_model_real,omitempty"` + MassMailingCampaignId *Many2One `xmlrpc:"mass_mailing_campaign_id,omitempty"` + MediumId *Many2One `xmlrpc:"medium_id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + NextDeparture *Time `xmlrpc:"next_departure,omitempty"` + Opened *Int `xmlrpc:"opened,omitempty"` + OpenedRatio *Int `xmlrpc:"opened_ratio,omitempty"` + ReceivedRatio *Int `xmlrpc:"received_ratio,omitempty"` + Replied *Int `xmlrpc:"replied,omitempty"` + RepliedRatio *Int `xmlrpc:"replied_ratio,omitempty"` + ReplyTo *String `xmlrpc:"reply_to,omitempty"` + ReplyToMode *Selection `xmlrpc:"reply_to_mode,omitempty"` + ScheduleDate *Time `xmlrpc:"schedule_date,omitempty"` + Scheduled *Int `xmlrpc:"scheduled,omitempty"` + Sent *Int `xmlrpc:"sent,omitempty"` + SentDate *Time `xmlrpc:"sent_date,omitempty"` + SourceId *Many2One `xmlrpc:"source_id,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + StatisticsIds *Relation `xmlrpc:"statistics_ids,omitempty"` + Total *Int `xmlrpc:"total,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// MailMassMailings represents array of mail.mass_mailing model. +type MailMassMailings []MailMassMailing + +// MailMassMailingModel is the odoo model name. +const MailMassMailingModel = "mail.mass_mailing" + +// Many2One convert MailMassMailing to *Many2One. +func (mm *MailMassMailing) Many2One() *Many2One { + return NewMany2One(mm.Id.Get(), "") +} + +// CreateMailMassMailing creates a new mail.mass_mailing model and returns its id. +func (c *Client) CreateMailMassMailing(mm *MailMassMailing) (int64, error) { + return c.Create(MailMassMailingModel, mm) +} + +// UpdateMailMassMailing updates an existing mail.mass_mailing record. +func (c *Client) UpdateMailMassMailing(mm *MailMassMailing) error { + return c.UpdateMailMassMailings([]int64{mm.Id.Get()}, mm) +} + +// UpdateMailMassMailings updates existing mail.mass_mailing records. +// All records (represented by ids) will be updated by mm values. +func (c *Client) UpdateMailMassMailings(ids []int64, mm *MailMassMailing) error { + return c.Update(MailMassMailingModel, ids, mm) +} + +// DeleteMailMassMailing deletes an existing mail.mass_mailing record. +func (c *Client) DeleteMailMassMailing(id int64) error { + return c.DeleteMailMassMailings([]int64{id}) +} + +// DeleteMailMassMailings deletes existing mail.mass_mailing records. +func (c *Client) DeleteMailMassMailings(ids []int64) error { + return c.Delete(MailMassMailingModel, ids) +} + +// GetMailMassMailing gets mail.mass_mailing existing record. +func (c *Client) GetMailMassMailing(id int64) (*MailMassMailing, error) { + mms, err := c.GetMailMassMailings([]int64{id}) + if err != nil { + return nil, err + } + if mms != nil && len(*mms) > 0 { + return &((*mms)[0]), nil + } + return nil, fmt.Errorf("id %v of mail.mass_mailing not found", id) +} + +// GetMailMassMailings gets mail.mass_mailing existing records. +func (c *Client) GetMailMassMailings(ids []int64) (*MailMassMailings, error) { + mms := &MailMassMailings{} + if err := c.Read(MailMassMailingModel, ids, nil, mms); err != nil { + return nil, err + } + return mms, nil +} + +// FindMailMassMailing finds mail.mass_mailing record by querying it with criteria. +func (c *Client) FindMailMassMailing(criteria *Criteria) (*MailMassMailing, error) { + mms := &MailMassMailings{} + if err := c.SearchRead(MailMassMailingModel, criteria, NewOptions().Limit(1), mms); err != nil { + return nil, err + } + if mms != nil && len(*mms) > 0 { + return &((*mms)[0]), nil + } + return nil, fmt.Errorf("no mail.mass_mailing was found with criteria %v", criteria) +} + +// FindMailMassMailings finds mail.mass_mailing records by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailMassMailings(criteria *Criteria, options *Options) (*MailMassMailings, error) { + mms := &MailMassMailings{} + if err := c.SearchRead(MailMassMailingModel, criteria, options, mms); err != nil { + return nil, err + } + return mms, nil +} + +// FindMailMassMailingIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailMassMailingIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(MailMassMailingModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindMailMassMailingId finds record id by querying it with criteria. +func (c *Client) FindMailMassMailingId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(MailMassMailingModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no mail.mass_mailing was found with criteria %v and options %v", criteria, options) +} diff --git a/mail_mass_mailing_campaign.go b/mail_mass_mailing_campaign.go new file mode 100644 index 00000000..30df630b --- /dev/null +++ b/mail_mass_mailing_campaign.go @@ -0,0 +1,142 @@ +package odoo + +import ( + "fmt" +) + +// MailMassMailingCampaign represents mail.mass_mailing.campaign model. +type MailMassMailingCampaign struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + Bounced *Int `xmlrpc:"bounced,omitempty"` + BouncedRatio *Int `xmlrpc:"bounced_ratio,omitempty"` + CampaignId *Many2One `xmlrpc:"campaign_id,omitempty"` + ClicksRatio *Int `xmlrpc:"clicks_ratio,omitempty"` + Color *Int `xmlrpc:"color,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Delivered *Int `xmlrpc:"delivered,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Failed *Int `xmlrpc:"failed,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + MassMailingIds *Relation `xmlrpc:"mass_mailing_ids,omitempty"` + MediumId *Many2One `xmlrpc:"medium_id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Opened *Int `xmlrpc:"opened,omitempty"` + OpenedRatio *Int `xmlrpc:"opened_ratio,omitempty"` + ReceivedRatio *Int `xmlrpc:"received_ratio,omitempty"` + Replied *Int `xmlrpc:"replied,omitempty"` + RepliedRatio *Int `xmlrpc:"replied_ratio,omitempty"` + Scheduled *Int `xmlrpc:"scheduled,omitempty"` + Sent *Int `xmlrpc:"sent,omitempty"` + SourceId *Many2One `xmlrpc:"source_id,omitempty"` + StageId *Many2One `xmlrpc:"stage_id,omitempty"` + TagIds *Relation `xmlrpc:"tag_ids,omitempty"` + Total *Int `xmlrpc:"total,omitempty"` + TotalMailings *Int `xmlrpc:"total_mailings,omitempty"` + UniqueAbTesting *Bool `xmlrpc:"unique_ab_testing,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// MailMassMailingCampaigns represents array of mail.mass_mailing.campaign model. +type MailMassMailingCampaigns []MailMassMailingCampaign + +// MailMassMailingCampaignModel is the odoo model name. +const MailMassMailingCampaignModel = "mail.mass_mailing.campaign" + +// Many2One convert MailMassMailingCampaign to *Many2One. +func (mmc *MailMassMailingCampaign) Many2One() *Many2One { + return NewMany2One(mmc.Id.Get(), "") +} + +// CreateMailMassMailingCampaign creates a new mail.mass_mailing.campaign model and returns its id. +func (c *Client) CreateMailMassMailingCampaign(mmc *MailMassMailingCampaign) (int64, error) { + return c.Create(MailMassMailingCampaignModel, mmc) +} + +// UpdateMailMassMailingCampaign updates an existing mail.mass_mailing.campaign record. +func (c *Client) UpdateMailMassMailingCampaign(mmc *MailMassMailingCampaign) error { + return c.UpdateMailMassMailingCampaigns([]int64{mmc.Id.Get()}, mmc) +} + +// UpdateMailMassMailingCampaigns updates existing mail.mass_mailing.campaign records. +// All records (represented by ids) will be updated by mmc values. +func (c *Client) UpdateMailMassMailingCampaigns(ids []int64, mmc *MailMassMailingCampaign) error { + return c.Update(MailMassMailingCampaignModel, ids, mmc) +} + +// DeleteMailMassMailingCampaign deletes an existing mail.mass_mailing.campaign record. +func (c *Client) DeleteMailMassMailingCampaign(id int64) error { + return c.DeleteMailMassMailingCampaigns([]int64{id}) +} + +// DeleteMailMassMailingCampaigns deletes existing mail.mass_mailing.campaign records. +func (c *Client) DeleteMailMassMailingCampaigns(ids []int64) error { + return c.Delete(MailMassMailingCampaignModel, ids) +} + +// GetMailMassMailingCampaign gets mail.mass_mailing.campaign existing record. +func (c *Client) GetMailMassMailingCampaign(id int64) (*MailMassMailingCampaign, error) { + mmcs, err := c.GetMailMassMailingCampaigns([]int64{id}) + if err != nil { + return nil, err + } + if mmcs != nil && len(*mmcs) > 0 { + return &((*mmcs)[0]), nil + } + return nil, fmt.Errorf("id %v of mail.mass_mailing.campaign not found", id) +} + +// GetMailMassMailingCampaigns gets mail.mass_mailing.campaign existing records. +func (c *Client) GetMailMassMailingCampaigns(ids []int64) (*MailMassMailingCampaigns, error) { + mmcs := &MailMassMailingCampaigns{} + if err := c.Read(MailMassMailingCampaignModel, ids, nil, mmcs); err != nil { + return nil, err + } + return mmcs, nil +} + +// FindMailMassMailingCampaign finds mail.mass_mailing.campaign record by querying it with criteria. +func (c *Client) FindMailMassMailingCampaign(criteria *Criteria) (*MailMassMailingCampaign, error) { + mmcs := &MailMassMailingCampaigns{} + if err := c.SearchRead(MailMassMailingCampaignModel, criteria, NewOptions().Limit(1), mmcs); err != nil { + return nil, err + } + if mmcs != nil && len(*mmcs) > 0 { + return &((*mmcs)[0]), nil + } + return nil, fmt.Errorf("no mail.mass_mailing.campaign was found with criteria %v", criteria) +} + +// FindMailMassMailingCampaigns finds mail.mass_mailing.campaign records by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailMassMailingCampaigns(criteria *Criteria, options *Options) (*MailMassMailingCampaigns, error) { + mmcs := &MailMassMailingCampaigns{} + if err := c.SearchRead(MailMassMailingCampaignModel, criteria, options, mmcs); err != nil { + return nil, err + } + return mmcs, nil +} + +// FindMailMassMailingCampaignIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailMassMailingCampaignIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(MailMassMailingCampaignModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindMailMassMailingCampaignId finds record id by querying it with criteria. +func (c *Client) FindMailMassMailingCampaignId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(MailMassMailingCampaignModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no mail.mass_mailing.campaign was found with criteria %v and options %v", criteria, options) +} diff --git a/mail_mass_mailing_contact.go b/mail_mass_mailing_contact.go new file mode 100644 index 00000000..ca1ba80d --- /dev/null +++ b/mail_mass_mailing_contact.go @@ -0,0 +1,139 @@ +package odoo + +import ( + "fmt" +) + +// MailMassMailingContact represents mail.mass_mailing.contact model. +type MailMassMailingContact struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CompanyName *String `xmlrpc:"company_name,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"` + Email *String `xmlrpc:"email,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + ListIds *Relation `xmlrpc:"list_ids,omitempty"` + MessageBounce *Int `xmlrpc:"message_bounce,omitempty"` + MessageChannelIds *Relation `xmlrpc:"message_channel_ids,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageLastPost *Time `xmlrpc:"message_last_post,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MessageUnread *Bool `xmlrpc:"message_unread,omitempty"` + MessageUnreadCounter *Int `xmlrpc:"message_unread_counter,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + OptOut *Bool `xmlrpc:"opt_out,omitempty"` + TagIds *Relation `xmlrpc:"tag_ids,omitempty"` + TitleId *Many2One `xmlrpc:"title_id,omitempty"` + UnsubscriptionDate *Time `xmlrpc:"unsubscription_date,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// MailMassMailingContacts represents array of mail.mass_mailing.contact model. +type MailMassMailingContacts []MailMassMailingContact + +// MailMassMailingContactModel is the odoo model name. +const MailMassMailingContactModel = "mail.mass_mailing.contact" + +// Many2One convert MailMassMailingContact to *Many2One. +func (mmc *MailMassMailingContact) Many2One() *Many2One { + return NewMany2One(mmc.Id.Get(), "") +} + +// CreateMailMassMailingContact creates a new mail.mass_mailing.contact model and returns its id. +func (c *Client) CreateMailMassMailingContact(mmc *MailMassMailingContact) (int64, error) { + return c.Create(MailMassMailingContactModel, mmc) +} + +// UpdateMailMassMailingContact updates an existing mail.mass_mailing.contact record. +func (c *Client) UpdateMailMassMailingContact(mmc *MailMassMailingContact) error { + return c.UpdateMailMassMailingContacts([]int64{mmc.Id.Get()}, mmc) +} + +// UpdateMailMassMailingContacts updates existing mail.mass_mailing.contact records. +// All records (represented by ids) will be updated by mmc values. +func (c *Client) UpdateMailMassMailingContacts(ids []int64, mmc *MailMassMailingContact) error { + return c.Update(MailMassMailingContactModel, ids, mmc) +} + +// DeleteMailMassMailingContact deletes an existing mail.mass_mailing.contact record. +func (c *Client) DeleteMailMassMailingContact(id int64) error { + return c.DeleteMailMassMailingContacts([]int64{id}) +} + +// DeleteMailMassMailingContacts deletes existing mail.mass_mailing.contact records. +func (c *Client) DeleteMailMassMailingContacts(ids []int64) error { + return c.Delete(MailMassMailingContactModel, ids) +} + +// GetMailMassMailingContact gets mail.mass_mailing.contact existing record. +func (c *Client) GetMailMassMailingContact(id int64) (*MailMassMailingContact, error) { + mmcs, err := c.GetMailMassMailingContacts([]int64{id}) + if err != nil { + return nil, err + } + if mmcs != nil && len(*mmcs) > 0 { + return &((*mmcs)[0]), nil + } + return nil, fmt.Errorf("id %v of mail.mass_mailing.contact not found", id) +} + +// GetMailMassMailingContacts gets mail.mass_mailing.contact existing records. +func (c *Client) GetMailMassMailingContacts(ids []int64) (*MailMassMailingContacts, error) { + mmcs := &MailMassMailingContacts{} + if err := c.Read(MailMassMailingContactModel, ids, nil, mmcs); err != nil { + return nil, err + } + return mmcs, nil +} + +// FindMailMassMailingContact finds mail.mass_mailing.contact record by querying it with criteria. +func (c *Client) FindMailMassMailingContact(criteria *Criteria) (*MailMassMailingContact, error) { + mmcs := &MailMassMailingContacts{} + if err := c.SearchRead(MailMassMailingContactModel, criteria, NewOptions().Limit(1), mmcs); err != nil { + return nil, err + } + if mmcs != nil && len(*mmcs) > 0 { + return &((*mmcs)[0]), nil + } + return nil, fmt.Errorf("no mail.mass_mailing.contact was found with criteria %v", criteria) +} + +// FindMailMassMailingContacts finds mail.mass_mailing.contact records by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailMassMailingContacts(criteria *Criteria, options *Options) (*MailMassMailingContacts, error) { + mmcs := &MailMassMailingContacts{} + if err := c.SearchRead(MailMassMailingContactModel, criteria, options, mmcs); err != nil { + return nil, err + } + return mmcs, nil +} + +// FindMailMassMailingContactIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailMassMailingContactIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(MailMassMailingContactModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindMailMassMailingContactId finds record id by querying it with criteria. +func (c *Client) FindMailMassMailingContactId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(MailMassMailingContactModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no mail.mass_mailing.contact was found with criteria %v and options %v", criteria, options) +} diff --git a/mail_mass_mailing_list.go b/mail_mass_mailing_list.go new file mode 100644 index 00000000..7d845e88 --- /dev/null +++ b/mail_mass_mailing_list.go @@ -0,0 +1,121 @@ +package odoo + +import ( + "fmt" +) + +// MailMassMailingList represents mail.mass_mailing.list model. +type MailMassMailingList struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + Active *Bool `xmlrpc:"active,omitempty"` + ContactNbr *Int `xmlrpc:"contact_nbr,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"` +} + +// MailMassMailingLists represents array of mail.mass_mailing.list model. +type MailMassMailingLists []MailMassMailingList + +// MailMassMailingListModel is the odoo model name. +const MailMassMailingListModel = "mail.mass_mailing.list" + +// Many2One convert MailMassMailingList to *Many2One. +func (mml *MailMassMailingList) Many2One() *Many2One { + return NewMany2One(mml.Id.Get(), "") +} + +// CreateMailMassMailingList creates a new mail.mass_mailing.list model and returns its id. +func (c *Client) CreateMailMassMailingList(mml *MailMassMailingList) (int64, error) { + return c.Create(MailMassMailingListModel, mml) +} + +// UpdateMailMassMailingList updates an existing mail.mass_mailing.list record. +func (c *Client) UpdateMailMassMailingList(mml *MailMassMailingList) error { + return c.UpdateMailMassMailingLists([]int64{mml.Id.Get()}, mml) +} + +// UpdateMailMassMailingLists updates existing mail.mass_mailing.list records. +// All records (represented by ids) will be updated by mml values. +func (c *Client) UpdateMailMassMailingLists(ids []int64, mml *MailMassMailingList) error { + return c.Update(MailMassMailingListModel, ids, mml) +} + +// DeleteMailMassMailingList deletes an existing mail.mass_mailing.list record. +func (c *Client) DeleteMailMassMailingList(id int64) error { + return c.DeleteMailMassMailingLists([]int64{id}) +} + +// DeleteMailMassMailingLists deletes existing mail.mass_mailing.list records. +func (c *Client) DeleteMailMassMailingLists(ids []int64) error { + return c.Delete(MailMassMailingListModel, ids) +} + +// GetMailMassMailingList gets mail.mass_mailing.list existing record. +func (c *Client) GetMailMassMailingList(id int64) (*MailMassMailingList, error) { + mmls, err := c.GetMailMassMailingLists([]int64{id}) + if err != nil { + return nil, err + } + if mmls != nil && len(*mmls) > 0 { + return &((*mmls)[0]), nil + } + return nil, fmt.Errorf("id %v of mail.mass_mailing.list not found", id) +} + +// GetMailMassMailingLists gets mail.mass_mailing.list existing records. +func (c *Client) GetMailMassMailingLists(ids []int64) (*MailMassMailingLists, error) { + mmls := &MailMassMailingLists{} + if err := c.Read(MailMassMailingListModel, ids, nil, mmls); err != nil { + return nil, err + } + return mmls, nil +} + +// FindMailMassMailingList finds mail.mass_mailing.list record by querying it with criteria. +func (c *Client) FindMailMassMailingList(criteria *Criteria) (*MailMassMailingList, error) { + mmls := &MailMassMailingLists{} + if err := c.SearchRead(MailMassMailingListModel, criteria, NewOptions().Limit(1), mmls); err != nil { + return nil, err + } + if mmls != nil && len(*mmls) > 0 { + return &((*mmls)[0]), nil + } + return nil, fmt.Errorf("no mail.mass_mailing.list was found with criteria %v", criteria) +} + +// FindMailMassMailingLists finds mail.mass_mailing.list records by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailMassMailingLists(criteria *Criteria, options *Options) (*MailMassMailingLists, error) { + mmls := &MailMassMailingLists{} + if err := c.SearchRead(MailMassMailingListModel, criteria, options, mmls); err != nil { + return nil, err + } + return mmls, nil +} + +// FindMailMassMailingListIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailMassMailingListIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(MailMassMailingListModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindMailMassMailingListId finds record id by querying it with criteria. +func (c *Client) FindMailMassMailingListId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(MailMassMailingListModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no mail.mass_mailing.list was found with criteria %v and options %v", criteria, options) +} diff --git a/mail_mass_mailing_stage.go b/mail_mass_mailing_stage.go new file mode 100644 index 00000000..75fe4bf6 --- /dev/null +++ b/mail_mass_mailing_stage.go @@ -0,0 +1,120 @@ +package odoo + +import ( + "fmt" +) + +// MailMassMailingStage represents mail.mass_mailing.stage model. +type MailMassMailingStage struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` +} + +// MailMassMailingStages represents array of mail.mass_mailing.stage model. +type MailMassMailingStages []MailMassMailingStage + +// MailMassMailingStageModel is the odoo model name. +const MailMassMailingStageModel = "mail.mass_mailing.stage" + +// Many2One convert MailMassMailingStage to *Many2One. +func (mms *MailMassMailingStage) Many2One() *Many2One { + return NewMany2One(mms.Id.Get(), "") +} + +// CreateMailMassMailingStage creates a new mail.mass_mailing.stage model and returns its id. +func (c *Client) CreateMailMassMailingStage(mms *MailMassMailingStage) (int64, error) { + return c.Create(MailMassMailingStageModel, mms) +} + +// UpdateMailMassMailingStage updates an existing mail.mass_mailing.stage record. +func (c *Client) UpdateMailMassMailingStage(mms *MailMassMailingStage) error { + return c.UpdateMailMassMailingStages([]int64{mms.Id.Get()}, mms) +} + +// UpdateMailMassMailingStages updates existing mail.mass_mailing.stage records. +// All records (represented by ids) will be updated by mms values. +func (c *Client) UpdateMailMassMailingStages(ids []int64, mms *MailMassMailingStage) error { + return c.Update(MailMassMailingStageModel, ids, mms) +} + +// DeleteMailMassMailingStage deletes an existing mail.mass_mailing.stage record. +func (c *Client) DeleteMailMassMailingStage(id int64) error { + return c.DeleteMailMassMailingStages([]int64{id}) +} + +// DeleteMailMassMailingStages deletes existing mail.mass_mailing.stage records. +func (c *Client) DeleteMailMassMailingStages(ids []int64) error { + return c.Delete(MailMassMailingStageModel, ids) +} + +// GetMailMassMailingStage gets mail.mass_mailing.stage existing record. +func (c *Client) GetMailMassMailingStage(id int64) (*MailMassMailingStage, error) { + mmss, err := c.GetMailMassMailingStages([]int64{id}) + if err != nil { + return nil, err + } + if mmss != nil && len(*mmss) > 0 { + return &((*mmss)[0]), nil + } + return nil, fmt.Errorf("id %v of mail.mass_mailing.stage not found", id) +} + +// GetMailMassMailingStages gets mail.mass_mailing.stage existing records. +func (c *Client) GetMailMassMailingStages(ids []int64) (*MailMassMailingStages, error) { + mmss := &MailMassMailingStages{} + if err := c.Read(MailMassMailingStageModel, ids, nil, mmss); err != nil { + return nil, err + } + return mmss, nil +} + +// FindMailMassMailingStage finds mail.mass_mailing.stage record by querying it with criteria. +func (c *Client) FindMailMassMailingStage(criteria *Criteria) (*MailMassMailingStage, error) { + mmss := &MailMassMailingStages{} + if err := c.SearchRead(MailMassMailingStageModel, criteria, NewOptions().Limit(1), mmss); err != nil { + return nil, err + } + if mmss != nil && len(*mmss) > 0 { + return &((*mmss)[0]), nil + } + return nil, fmt.Errorf("no mail.mass_mailing.stage was found with criteria %v", criteria) +} + +// FindMailMassMailingStages finds mail.mass_mailing.stage records by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailMassMailingStages(criteria *Criteria, options *Options) (*MailMassMailingStages, error) { + mmss := &MailMassMailingStages{} + if err := c.SearchRead(MailMassMailingStageModel, criteria, options, mmss); err != nil { + return nil, err + } + return mmss, nil +} + +// FindMailMassMailingStageIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailMassMailingStageIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(MailMassMailingStageModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindMailMassMailingStageId finds record id by querying it with criteria. +func (c *Client) FindMailMassMailingStageId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(MailMassMailingStageModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no mail.mass_mailing.stage was found with criteria %v and options %v", criteria, options) +} diff --git a/mail_mass_mailing_tag.go b/mail_mass_mailing_tag.go new file mode 100644 index 00000000..1a7f2bd4 --- /dev/null +++ b/mail_mass_mailing_tag.go @@ -0,0 +1,120 @@ +package odoo + +import ( + "fmt" +) + +// MailMassMailingTag represents mail.mass_mailing.tag model. +type MailMassMailingTag struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// MailMassMailingTags represents array of mail.mass_mailing.tag model. +type MailMassMailingTags []MailMassMailingTag + +// MailMassMailingTagModel is the odoo model name. +const MailMassMailingTagModel = "mail.mass_mailing.tag" + +// Many2One convert MailMassMailingTag to *Many2One. +func (mmt *MailMassMailingTag) Many2One() *Many2One { + return NewMany2One(mmt.Id.Get(), "") +} + +// CreateMailMassMailingTag creates a new mail.mass_mailing.tag model and returns its id. +func (c *Client) CreateMailMassMailingTag(mmt *MailMassMailingTag) (int64, error) { + return c.Create(MailMassMailingTagModel, mmt) +} + +// UpdateMailMassMailingTag updates an existing mail.mass_mailing.tag record. +func (c *Client) UpdateMailMassMailingTag(mmt *MailMassMailingTag) error { + return c.UpdateMailMassMailingTags([]int64{mmt.Id.Get()}, mmt) +} + +// UpdateMailMassMailingTags updates existing mail.mass_mailing.tag records. +// All records (represented by ids) will be updated by mmt values. +func (c *Client) UpdateMailMassMailingTags(ids []int64, mmt *MailMassMailingTag) error { + return c.Update(MailMassMailingTagModel, ids, mmt) +} + +// DeleteMailMassMailingTag deletes an existing mail.mass_mailing.tag record. +func (c *Client) DeleteMailMassMailingTag(id int64) error { + return c.DeleteMailMassMailingTags([]int64{id}) +} + +// DeleteMailMassMailingTags deletes existing mail.mass_mailing.tag records. +func (c *Client) DeleteMailMassMailingTags(ids []int64) error { + return c.Delete(MailMassMailingTagModel, ids) +} + +// GetMailMassMailingTag gets mail.mass_mailing.tag existing record. +func (c *Client) GetMailMassMailingTag(id int64) (*MailMassMailingTag, error) { + mmts, err := c.GetMailMassMailingTags([]int64{id}) + if err != nil { + return nil, err + } + if mmts != nil && len(*mmts) > 0 { + return &((*mmts)[0]), nil + } + return nil, fmt.Errorf("id %v of mail.mass_mailing.tag not found", id) +} + +// GetMailMassMailingTags gets mail.mass_mailing.tag existing records. +func (c *Client) GetMailMassMailingTags(ids []int64) (*MailMassMailingTags, error) { + mmts := &MailMassMailingTags{} + if err := c.Read(MailMassMailingTagModel, ids, nil, mmts); err != nil { + return nil, err + } + return mmts, nil +} + +// FindMailMassMailingTag finds mail.mass_mailing.tag record by querying it with criteria. +func (c *Client) FindMailMassMailingTag(criteria *Criteria) (*MailMassMailingTag, error) { + mmts := &MailMassMailingTags{} + if err := c.SearchRead(MailMassMailingTagModel, criteria, NewOptions().Limit(1), mmts); err != nil { + return nil, err + } + if mmts != nil && len(*mmts) > 0 { + return &((*mmts)[0]), nil + } + return nil, fmt.Errorf("no mail.mass_mailing.tag was found with criteria %v", criteria) +} + +// FindMailMassMailingTags finds mail.mass_mailing.tag records by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailMassMailingTags(criteria *Criteria, options *Options) (*MailMassMailingTags, error) { + mmts := &MailMassMailingTags{} + if err := c.SearchRead(MailMassMailingTagModel, criteria, options, mmts); err != nil { + return nil, err + } + return mmts, nil +} + +// FindMailMassMailingTagIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailMassMailingTagIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(MailMassMailingTagModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindMailMassMailingTagId finds record id by querying it with criteria. +func (c *Client) FindMailMassMailingTagId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(MailMassMailingTagModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no mail.mass_mailing.tag was found with criteria %v and options %v", criteria, options) +} diff --git a/mail_mass_mailing_test.go b/mail_mass_mailing_test.go new file mode 100644 index 00000000..5eb85b29 --- /dev/null +++ b/mail_mass_mailing_test.go @@ -0,0 +1,120 @@ +package odoo + +import ( + "fmt" +) + +// MailMassMailingTest represents mail.mass_mailing.test model. +type MailMassMailingTest struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + EmailTo *String `xmlrpc:"email_to,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + MassMailingId *Many2One `xmlrpc:"mass_mailing_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// MailMassMailingTests represents array of mail.mass_mailing.test model. +type MailMassMailingTests []MailMassMailingTest + +// MailMassMailingTestModel is the odoo model name. +const MailMassMailingTestModel = "mail.mass_mailing.test" + +// Many2One convert MailMassMailingTest to *Many2One. +func (mmt *MailMassMailingTest) Many2One() *Many2One { + return NewMany2One(mmt.Id.Get(), "") +} + +// CreateMailMassMailingTest creates a new mail.mass_mailing.test model and returns its id. +func (c *Client) CreateMailMassMailingTest(mmt *MailMassMailingTest) (int64, error) { + return c.Create(MailMassMailingTestModel, mmt) +} + +// UpdateMailMassMailingTest updates an existing mail.mass_mailing.test record. +func (c *Client) UpdateMailMassMailingTest(mmt *MailMassMailingTest) error { + return c.UpdateMailMassMailingTests([]int64{mmt.Id.Get()}, mmt) +} + +// UpdateMailMassMailingTests updates existing mail.mass_mailing.test records. +// All records (represented by ids) will be updated by mmt values. +func (c *Client) UpdateMailMassMailingTests(ids []int64, mmt *MailMassMailingTest) error { + return c.Update(MailMassMailingTestModel, ids, mmt) +} + +// DeleteMailMassMailingTest deletes an existing mail.mass_mailing.test record. +func (c *Client) DeleteMailMassMailingTest(id int64) error { + return c.DeleteMailMassMailingTests([]int64{id}) +} + +// DeleteMailMassMailingTests deletes existing mail.mass_mailing.test records. +func (c *Client) DeleteMailMassMailingTests(ids []int64) error { + return c.Delete(MailMassMailingTestModel, ids) +} + +// GetMailMassMailingTest gets mail.mass_mailing.test existing record. +func (c *Client) GetMailMassMailingTest(id int64) (*MailMassMailingTest, error) { + mmts, err := c.GetMailMassMailingTests([]int64{id}) + if err != nil { + return nil, err + } + if mmts != nil && len(*mmts) > 0 { + return &((*mmts)[0]), nil + } + return nil, fmt.Errorf("id %v of mail.mass_mailing.test not found", id) +} + +// GetMailMassMailingTests gets mail.mass_mailing.test existing records. +func (c *Client) GetMailMassMailingTests(ids []int64) (*MailMassMailingTests, error) { + mmts := &MailMassMailingTests{} + if err := c.Read(MailMassMailingTestModel, ids, nil, mmts); err != nil { + return nil, err + } + return mmts, nil +} + +// FindMailMassMailingTest finds mail.mass_mailing.test record by querying it with criteria. +func (c *Client) FindMailMassMailingTest(criteria *Criteria) (*MailMassMailingTest, error) { + mmts := &MailMassMailingTests{} + if err := c.SearchRead(MailMassMailingTestModel, criteria, NewOptions().Limit(1), mmts); err != nil { + return nil, err + } + if mmts != nil && len(*mmts) > 0 { + return &((*mmts)[0]), nil + } + return nil, fmt.Errorf("no mail.mass_mailing.test was found with criteria %v", criteria) +} + +// FindMailMassMailingTests finds mail.mass_mailing.test records by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailMassMailingTests(criteria *Criteria, options *Options) (*MailMassMailingTests, error) { + mmts := &MailMassMailingTests{} + if err := c.SearchRead(MailMassMailingTestModel, criteria, options, mmts); err != nil { + return nil, err + } + return mmts, nil +} + +// FindMailMassMailingTestIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailMassMailingTestIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(MailMassMailingTestModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindMailMassMailingTestId finds record id by querying it with criteria. +func (c *Client) FindMailMassMailingTestId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(MailMassMailingTestModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no mail.mass_mailing.test was found with criteria %v and options %v", criteria, options) +} diff --git a/mail_message.go b/mail_message.go new file mode 100644 index 00000000..3695220f --- /dev/null +++ b/mail_message.go @@ -0,0 +1,147 @@ +package odoo + +import ( + "fmt" +) + +// MailMessage represents mail.message model. +type MailMessage struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AttachmentIds *Relation `xmlrpc:"attachment_ids,omitempty"` + AuthorAvatar *String `xmlrpc:"author_avatar,omitempty"` + AuthorId *Many2One `xmlrpc:"author_id,omitempty"` + Body *String `xmlrpc:"body,omitempty"` + ChannelIds *Relation `xmlrpc:"channel_ids,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"` + EmailFrom *String `xmlrpc:"email_from,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + MailActivityTypeId *Many2One `xmlrpc:"mail_activity_type_id,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"` + NeedactionPartnerIds *Relation `xmlrpc:"needaction_partner_ids,omitempty"` + NoAutoThread *Bool `xmlrpc:"no_auto_thread,omitempty"` + NotificationIds *Relation `xmlrpc:"notification_ids,omitempty"` + ParentId *Many2One `xmlrpc:"parent_id,omitempty"` + PartnerIds *Relation `xmlrpc:"partner_ids,omitempty"` + RatingIds *Relation `xmlrpc:"rating_ids,omitempty"` + RatingValue *Float `xmlrpc:"rating_value,omitempty"` + RecordName *String `xmlrpc:"record_name,omitempty"` + ReplyTo *String `xmlrpc:"reply_to,omitempty"` + ResId *Int `xmlrpc:"res_id,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) { + return c.Create(MailMessageModel, mm) +} + +// 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) +} + +// 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 + } + if mms != nil && len(*mms) > 0 { + return &((*mms)[0]), nil + } + return nil, fmt.Errorf("id %v of mail.message not found", id) +} + +// 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 + } + if mms != nil && len(*mms) > 0 { + return &((*mms)[0]), nil + } + return nil, fmt.Errorf("no mail.message was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(MailMessageModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no mail.message was found with criteria %v and options %v", criteria, options) +} diff --git a/mail_message_subtype.go b/mail_message_subtype.go new file mode 100644 index 00000000..76c15f07 --- /dev/null +++ b/mail_message_subtype.go @@ -0,0 +1,127 @@ +package odoo + +import ( + "fmt" +) + +// MailMessageSubtype represents mail.message.subtype model. +type MailMessageSubtype struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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"` + 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) { + return c.Create(MailMessageSubtypeModel, mms) +} + +// 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) +} + +// 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 + } + if mmss != nil && len(*mmss) > 0 { + return &((*mmss)[0]), nil + } + return nil, fmt.Errorf("id %v of mail.message.subtype not found", id) +} + +// 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 + } + if mmss != nil && len(*mmss) > 0 { + return &((*mmss)[0]), nil + } + return nil, fmt.Errorf("no mail.message.subtype was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(MailMessageSubtypeModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no mail.message.subtype was found with criteria %v and options %v", criteria, options) +} diff --git a/mail_notification.go b/mail_notification.go new file mode 100644 index 00000000..07850ee5 --- /dev/null +++ b/mail_notification.go @@ -0,0 +1,119 @@ +package odoo + +import ( + "fmt" +) + +// MailNotification represents mail.notification model. +type MailNotification struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + EmailStatus *Selection `xmlrpc:"email_status,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsEmail *Bool `xmlrpc:"is_email,omitempty"` + IsRead *Bool `xmlrpc:"is_read,omitempty"` + MailMessageId *Many2One `xmlrpc:"mail_message_id,omitempty"` + ResPartnerId *Many2One `xmlrpc:"res_partner_id,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) { + return c.Create(MailNotificationModel, mn) +} + +// 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) +} + +// 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 + } + if mns != nil && len(*mns) > 0 { + return &((*mns)[0]), nil + } + return nil, fmt.Errorf("id %v of mail.notification not found", id) +} + +// 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 + } + if mns != nil && len(*mns) > 0 { + return &((*mns)[0]), nil + } + return nil, fmt.Errorf("no mail.notification was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(MailNotificationModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no mail.notification was found with criteria %v and options %v", criteria, options) +} diff --git a/mail_shortcode.go b/mail_shortcode.go new file mode 100644 index 00000000..5f047194 --- /dev/null +++ b/mail_shortcode.go @@ -0,0 +1,123 @@ +package odoo + +import ( + "fmt" +) + +// MailShortcode represents mail.shortcode model. +type MailShortcode struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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"` + ShortcodeType *Selection `xmlrpc:"shortcode_type,omitempty"` + Source *String `xmlrpc:"source,omitempty"` + Substitution *String `xmlrpc:"substitution,omitempty"` + UnicodeSource *String `xmlrpc:"unicode_source,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// MailShortcodes represents array of mail.shortcode model. +type MailShortcodes []MailShortcode + +// MailShortcodeModel is the odoo model name. +const MailShortcodeModel = "mail.shortcode" + +// Many2One convert MailShortcode to *Many2One. +func (ms *MailShortcode) Many2One() *Many2One { + return NewMany2One(ms.Id.Get(), "") +} + +// CreateMailShortcode creates a new mail.shortcode model and returns its id. +func (c *Client) CreateMailShortcode(ms *MailShortcode) (int64, error) { + return c.Create(MailShortcodeModel, ms) +} + +// UpdateMailShortcode updates an existing mail.shortcode record. +func (c *Client) UpdateMailShortcode(ms *MailShortcode) error { + return c.UpdateMailShortcodes([]int64{ms.Id.Get()}, ms) +} + +// UpdateMailShortcodes updates existing mail.shortcode records. +// All records (represented by ids) will be updated by ms values. +func (c *Client) UpdateMailShortcodes(ids []int64, ms *MailShortcode) error { + return c.Update(MailShortcodeModel, ids, ms) +} + +// DeleteMailShortcode deletes an existing mail.shortcode record. +func (c *Client) DeleteMailShortcode(id int64) error { + return c.DeleteMailShortcodes([]int64{id}) +} + +// DeleteMailShortcodes deletes existing mail.shortcode records. +func (c *Client) DeleteMailShortcodes(ids []int64) error { + return c.Delete(MailShortcodeModel, ids) +} + +// GetMailShortcode gets mail.shortcode existing record. +func (c *Client) GetMailShortcode(id int64) (*MailShortcode, error) { + mss, err := c.GetMailShortcodes([]int64{id}) + if err != nil { + return nil, err + } + if mss != nil && len(*mss) > 0 { + return &((*mss)[0]), nil + } + return nil, fmt.Errorf("id %v of mail.shortcode not found", id) +} + +// GetMailShortcodes gets mail.shortcode existing records. +func (c *Client) GetMailShortcodes(ids []int64) (*MailShortcodes, error) { + mss := &MailShortcodes{} + if err := c.Read(MailShortcodeModel, ids, nil, mss); err != nil { + return nil, err + } + return mss, nil +} + +// FindMailShortcode finds mail.shortcode record by querying it with criteria. +func (c *Client) FindMailShortcode(criteria *Criteria) (*MailShortcode, error) { + mss := &MailShortcodes{} + if err := c.SearchRead(MailShortcodeModel, criteria, NewOptions().Limit(1), mss); err != nil { + return nil, err + } + if mss != nil && len(*mss) > 0 { + return &((*mss)[0]), nil + } + return nil, fmt.Errorf("no mail.shortcode was found with criteria %v", criteria) +} + +// FindMailShortcodes finds mail.shortcode records by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailShortcodes(criteria *Criteria, options *Options) (*MailShortcodes, error) { + mss := &MailShortcodes{} + if err := c.SearchRead(MailShortcodeModel, criteria, options, mss); err != nil { + return nil, err + } + return mss, nil +} + +// FindMailShortcodeIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailShortcodeIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(MailShortcodeModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindMailShortcodeId finds record id by querying it with criteria. +func (c *Client) FindMailShortcodeId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(MailShortcodeModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no mail.shortcode was found with criteria %v and options %v", criteria, options) +} diff --git a/mail_statistics_report.go b/mail_statistics_report.go new file mode 100644 index 00000000..5bc2d014 --- /dev/null +++ b/mail_statistics_report.go @@ -0,0 +1,124 @@ +package odoo + +import ( + "fmt" +) + +// MailStatisticsReport represents mail.statistics.report model. +type MailStatisticsReport struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + Bounced *Int `xmlrpc:"bounced,omitempty"` + Campaign *String `xmlrpc:"campaign,omitempty"` + Delivered *Int `xmlrpc:"delivered,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + EmailFrom *String `xmlrpc:"email_from,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Opened *Int `xmlrpc:"opened,omitempty"` + Replied *Int `xmlrpc:"replied,omitempty"` + ScheduledDate *Time `xmlrpc:"scheduled_date,omitempty"` + Sent *Int `xmlrpc:"sent,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` +} + +// MailStatisticsReports represents array of mail.statistics.report model. +type MailStatisticsReports []MailStatisticsReport + +// MailStatisticsReportModel is the odoo model name. +const MailStatisticsReportModel = "mail.statistics.report" + +// Many2One convert MailStatisticsReport to *Many2One. +func (msr *MailStatisticsReport) Many2One() *Many2One { + return NewMany2One(msr.Id.Get(), "") +} + +// CreateMailStatisticsReport creates a new mail.statistics.report model and returns its id. +func (c *Client) CreateMailStatisticsReport(msr *MailStatisticsReport) (int64, error) { + return c.Create(MailStatisticsReportModel, msr) +} + +// UpdateMailStatisticsReport updates an existing mail.statistics.report record. +func (c *Client) UpdateMailStatisticsReport(msr *MailStatisticsReport) error { + return c.UpdateMailStatisticsReports([]int64{msr.Id.Get()}, msr) +} + +// UpdateMailStatisticsReports updates existing mail.statistics.report records. +// All records (represented by ids) will be updated by msr values. +func (c *Client) UpdateMailStatisticsReports(ids []int64, msr *MailStatisticsReport) error { + return c.Update(MailStatisticsReportModel, ids, msr) +} + +// DeleteMailStatisticsReport deletes an existing mail.statistics.report record. +func (c *Client) DeleteMailStatisticsReport(id int64) error { + return c.DeleteMailStatisticsReports([]int64{id}) +} + +// DeleteMailStatisticsReports deletes existing mail.statistics.report records. +func (c *Client) DeleteMailStatisticsReports(ids []int64) error { + return c.Delete(MailStatisticsReportModel, ids) +} + +// GetMailStatisticsReport gets mail.statistics.report existing record. +func (c *Client) GetMailStatisticsReport(id int64) (*MailStatisticsReport, error) { + msrs, err := c.GetMailStatisticsReports([]int64{id}) + if err != nil { + return nil, err + } + if msrs != nil && len(*msrs) > 0 { + return &((*msrs)[0]), nil + } + return nil, fmt.Errorf("id %v of mail.statistics.report not found", id) +} + +// GetMailStatisticsReports gets mail.statistics.report existing records. +func (c *Client) GetMailStatisticsReports(ids []int64) (*MailStatisticsReports, error) { + msrs := &MailStatisticsReports{} + if err := c.Read(MailStatisticsReportModel, ids, nil, msrs); err != nil { + return nil, err + } + return msrs, nil +} + +// FindMailStatisticsReport finds mail.statistics.report record by querying it with criteria. +func (c *Client) FindMailStatisticsReport(criteria *Criteria) (*MailStatisticsReport, error) { + msrs := &MailStatisticsReports{} + if err := c.SearchRead(MailStatisticsReportModel, criteria, NewOptions().Limit(1), msrs); err != nil { + return nil, err + } + if msrs != nil && len(*msrs) > 0 { + return &((*msrs)[0]), nil + } + return nil, fmt.Errorf("no mail.statistics.report was found with criteria %v", criteria) +} + +// FindMailStatisticsReports finds mail.statistics.report records by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailStatisticsReports(criteria *Criteria, options *Options) (*MailStatisticsReports, error) { + msrs := &MailStatisticsReports{} + if err := c.SearchRead(MailStatisticsReportModel, criteria, options, msrs); err != nil { + return nil, err + } + return msrs, nil +} + +// FindMailStatisticsReportIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailStatisticsReportIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(MailStatisticsReportModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindMailStatisticsReportId finds record id by querying it with criteria. +func (c *Client) FindMailStatisticsReportId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(MailStatisticsReportModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no mail.statistics.report was found with criteria %v and options %v", criteria, options) +} diff --git a/mail_template.go b/mail_template.go new file mode 100644 index 00000000..8cc94e6c --- /dev/null +++ b/mail_template.go @@ -0,0 +1,143 @@ +package odoo + +import ( + "fmt" +) + +// MailTemplate represents mail.template model. +type MailTemplate struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AttachmentIds *Relation `xmlrpc:"attachment_ids,omitempty"` + AutoDelete *Bool `xmlrpc:"auto_delete,omitempty"` + BodyHtml *String `xmlrpc:"body_html,omitempty"` + Copyvalue *String `xmlrpc:"copyvalue,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"` + Id *Int `xmlrpc:"id,omitempty"` + Lang *String `xmlrpc:"lang,omitempty"` + MailServerId *Many2One `xmlrpc:"mail_server_id,omitempty"` + Model *String `xmlrpc:"model,omitempty"` + ModelId *Many2One `xmlrpc:"model_id,omitempty"` + ModelObjectField *Many2One `xmlrpc:"model_object_field,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + NullValue *String `xmlrpc:"null_value,omitempty"` + PartnerTo *String `xmlrpc:"partner_to,omitempty"` + RefIrActWindow *Many2One `xmlrpc:"ref_ir_act_window,omitempty"` + ReplyTo *String `xmlrpc:"reply_to,omitempty"` + ReportName *String `xmlrpc:"report_name,omitempty"` + ReportTemplate *Many2One `xmlrpc:"report_template,omitempty"` + ScheduledDate *String `xmlrpc:"scheduled_date,omitempty"` + SubModelObjectField *Many2One `xmlrpc:"sub_model_object_field,omitempty"` + SubObject *Many2One `xmlrpc:"sub_object,omitempty"` + Subject *String `xmlrpc:"subject,omitempty"` + UseDefaultTo *Bool `xmlrpc:"use_default_to,omitempty"` + UserSignature *Bool `xmlrpc:"user_signature,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) { + return c.Create(MailTemplateModel, mt) +} + +// 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) +} + +// 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 + } + if mts != nil && len(*mts) > 0 { + return &((*mts)[0]), nil + } + return nil, fmt.Errorf("id %v of mail.template not found", id) +} + +// 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 + } + if mts != nil && len(*mts) > 0 { + return &((*mts)[0]), nil + } + return nil, fmt.Errorf("no mail.template was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(MailTemplateModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no mail.template was found with criteria %v and options %v", criteria, options) +} diff --git a/mail_test.go b/mail_test.go new file mode 100644 index 00000000..14c66473 --- /dev/null +++ b/mail_test.go @@ -0,0 +1,141 @@ +package odoo + +import ( + "fmt" +) + +// MailTest represents mail.test model. +type MailTest struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AliasContact *Selection `xmlrpc:"alias_contact,omitempty"` + AliasDefaults *String `xmlrpc:"alias_defaults,omitempty"` + AliasDomain *String `xmlrpc:"alias_domain,omitempty"` + AliasForceThreadId *Int `xmlrpc:"alias_force_thread_id,omitempty"` + AliasId *Many2One `xmlrpc:"alias_id,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"` + AliasUserId *Many2One `xmlrpc:"alias_user_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"` + Id *Int `xmlrpc:"id,omitempty"` + MessageChannelIds *Relation `xmlrpc:"message_channel_ids,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageLastPost *Time `xmlrpc:"message_last_post,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MessageUnread *Bool `xmlrpc:"message_unread,omitempty"` + MessageUnreadCounter *Int `xmlrpc:"message_unread_counter,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// MailTests represents array of mail.test model. +type MailTests []MailTest + +// MailTestModel is the odoo model name. +const MailTestModel = "mail.test" + +// Many2One convert MailTest to *Many2One. +func (mt *MailTest) Many2One() *Many2One { + return NewMany2One(mt.Id.Get(), "") +} + +// CreateMailTest creates a new mail.test model and returns its id. +func (c *Client) CreateMailTest(mt *MailTest) (int64, error) { + return c.Create(MailTestModel, mt) +} + +// UpdateMailTest updates an existing mail.test record. +func (c *Client) UpdateMailTest(mt *MailTest) error { + return c.UpdateMailTests([]int64{mt.Id.Get()}, mt) +} + +// UpdateMailTests updates existing mail.test records. +// All records (represented by ids) will be updated by mt values. +func (c *Client) UpdateMailTests(ids []int64, mt *MailTest) error { + return c.Update(MailTestModel, ids, mt) +} + +// DeleteMailTest deletes an existing mail.test record. +func (c *Client) DeleteMailTest(id int64) error { + return c.DeleteMailTests([]int64{id}) +} + +// DeleteMailTests deletes existing mail.test records. +func (c *Client) DeleteMailTests(ids []int64) error { + return c.Delete(MailTestModel, ids) +} + +// GetMailTest gets mail.test existing record. +func (c *Client) GetMailTest(id int64) (*MailTest, error) { + mts, err := c.GetMailTests([]int64{id}) + if err != nil { + return nil, err + } + if mts != nil && len(*mts) > 0 { + return &((*mts)[0]), nil + } + return nil, fmt.Errorf("id %v of mail.test not found", id) +} + +// GetMailTests gets mail.test existing records. +func (c *Client) GetMailTests(ids []int64) (*MailTests, error) { + mts := &MailTests{} + if err := c.Read(MailTestModel, ids, nil, mts); err != nil { + return nil, err + } + return mts, nil +} + +// FindMailTest finds mail.test record by querying it with criteria. +func (c *Client) FindMailTest(criteria *Criteria) (*MailTest, error) { + mts := &MailTests{} + if err := c.SearchRead(MailTestModel, criteria, NewOptions().Limit(1), mts); err != nil { + return nil, err + } + if mts != nil && len(*mts) > 0 { + return &((*mts)[0]), nil + } + return nil, fmt.Errorf("no mail.test was found with criteria %v", criteria) +} + +// FindMailTests finds mail.test records by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailTests(criteria *Criteria, options *Options) (*MailTests, error) { + mts := &MailTests{} + if err := c.SearchRead(MailTestModel, criteria, options, mts); err != nil { + return nil, err + } + return mts, nil +} + +// FindMailTestIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailTestIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(MailTestModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindMailTestId finds record id by querying it with criteria. +func (c *Client) FindMailTestId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(MailTestModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no mail.test was found with criteria %v and options %v", criteria, options) +} diff --git a/mail_test_simple.go b/mail_test_simple.go new file mode 100644 index 00000000..4f8ffe7c --- /dev/null +++ b/mail_test_simple.go @@ -0,0 +1,132 @@ +package odoo + +import ( + "fmt" +) + +// MailTestSimple represents mail.test.simple model. +type MailTestSimple struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Description *String `xmlrpc:"description,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + EmailFrom *String `xmlrpc:"email_from,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + MessageChannelIds *Relation `xmlrpc:"message_channel_ids,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageLastPost *Time `xmlrpc:"message_last_post,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MessageUnread *Bool `xmlrpc:"message_unread,omitempty"` + MessageUnreadCounter *Int `xmlrpc:"message_unread_counter,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// MailTestSimples represents array of mail.test.simple model. +type MailTestSimples []MailTestSimple + +// MailTestSimpleModel is the odoo model name. +const MailTestSimpleModel = "mail.test.simple" + +// Many2One convert MailTestSimple to *Many2One. +func (mts *MailTestSimple) Many2One() *Many2One { + return NewMany2One(mts.Id.Get(), "") +} + +// CreateMailTestSimple creates a new mail.test.simple model and returns its id. +func (c *Client) CreateMailTestSimple(mts *MailTestSimple) (int64, error) { + return c.Create(MailTestSimpleModel, mts) +} + +// UpdateMailTestSimple updates an existing mail.test.simple record. +func (c *Client) UpdateMailTestSimple(mts *MailTestSimple) error { + return c.UpdateMailTestSimples([]int64{mts.Id.Get()}, mts) +} + +// UpdateMailTestSimples updates existing mail.test.simple records. +// All records (represented by ids) will be updated by mts values. +func (c *Client) UpdateMailTestSimples(ids []int64, mts *MailTestSimple) error { + return c.Update(MailTestSimpleModel, ids, mts) +} + +// DeleteMailTestSimple deletes an existing mail.test.simple record. +func (c *Client) DeleteMailTestSimple(id int64) error { + return c.DeleteMailTestSimples([]int64{id}) +} + +// DeleteMailTestSimples deletes existing mail.test.simple records. +func (c *Client) DeleteMailTestSimples(ids []int64) error { + return c.Delete(MailTestSimpleModel, ids) +} + +// GetMailTestSimple gets mail.test.simple existing record. +func (c *Client) GetMailTestSimple(id int64) (*MailTestSimple, error) { + mtss, err := c.GetMailTestSimples([]int64{id}) + if err != nil { + return nil, err + } + if mtss != nil && len(*mtss) > 0 { + return &((*mtss)[0]), nil + } + return nil, fmt.Errorf("id %v of mail.test.simple not found", id) +} + +// GetMailTestSimples gets mail.test.simple existing records. +func (c *Client) GetMailTestSimples(ids []int64) (*MailTestSimples, error) { + mtss := &MailTestSimples{} + if err := c.Read(MailTestSimpleModel, ids, nil, mtss); err != nil { + return nil, err + } + return mtss, nil +} + +// FindMailTestSimple finds mail.test.simple record by querying it with criteria. +func (c *Client) FindMailTestSimple(criteria *Criteria) (*MailTestSimple, error) { + mtss := &MailTestSimples{} + if err := c.SearchRead(MailTestSimpleModel, criteria, NewOptions().Limit(1), mtss); err != nil { + return nil, err + } + if mtss != nil && len(*mtss) > 0 { + return &((*mtss)[0]), nil + } + return nil, fmt.Errorf("no mail.test.simple was found with criteria %v", criteria) +} + +// FindMailTestSimples finds mail.test.simple records by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailTestSimples(criteria *Criteria, options *Options) (*MailTestSimples, error) { + mtss := &MailTestSimples{} + if err := c.SearchRead(MailTestSimpleModel, criteria, options, mtss); err != nil { + return nil, err + } + return mtss, nil +} + +// FindMailTestSimpleIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailTestSimpleIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(MailTestSimpleModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindMailTestSimpleId finds record id by querying it with criteria. +func (c *Client) FindMailTestSimpleId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(MailTestSimpleModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no mail.test.simple was found with criteria %v and options %v", criteria, options) +} diff --git a/mail_thread.go b/mail_thread.go new file mode 100644 index 00000000..bd1b35e7 --- /dev/null +++ b/mail_thread.go @@ -0,0 +1,125 @@ +package odoo + +import ( + "fmt" +) + +// MailThread represents mail.thread model. +type MailThread struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + MessageChannelIds *Relation `xmlrpc:"message_channel_ids,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageLastPost *Time `xmlrpc:"message_last_post,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MessageUnread *Bool `xmlrpc:"message_unread,omitempty"` + MessageUnreadCounter *Int `xmlrpc:"message_unread_counter,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` +} + +// MailThreads represents array of mail.thread model. +type MailThreads []MailThread + +// MailThreadModel is the odoo model name. +const MailThreadModel = "mail.thread" + +// Many2One convert MailThread to *Many2One. +func (mt *MailThread) Many2One() *Many2One { + return NewMany2One(mt.Id.Get(), "") +} + +// CreateMailThread creates a new mail.thread model and returns its id. +func (c *Client) CreateMailThread(mt *MailThread) (int64, error) { + return c.Create(MailThreadModel, mt) +} + +// UpdateMailThread updates an existing mail.thread record. +func (c *Client) UpdateMailThread(mt *MailThread) error { + return c.UpdateMailThreads([]int64{mt.Id.Get()}, mt) +} + +// UpdateMailThreads updates existing mail.thread records. +// All records (represented by ids) will be updated by mt values. +func (c *Client) UpdateMailThreads(ids []int64, mt *MailThread) error { + return c.Update(MailThreadModel, ids, mt) +} + +// DeleteMailThread deletes an existing mail.thread record. +func (c *Client) DeleteMailThread(id int64) error { + return c.DeleteMailThreads([]int64{id}) +} + +// DeleteMailThreads deletes existing mail.thread records. +func (c *Client) DeleteMailThreads(ids []int64) error { + return c.Delete(MailThreadModel, ids) +} + +// GetMailThread gets mail.thread existing record. +func (c *Client) GetMailThread(id int64) (*MailThread, error) { + mts, err := c.GetMailThreads([]int64{id}) + if err != nil { + return nil, err + } + if mts != nil && len(*mts) > 0 { + return &((*mts)[0]), nil + } + return nil, fmt.Errorf("id %v of mail.thread not found", id) +} + +// GetMailThreads gets mail.thread existing records. +func (c *Client) GetMailThreads(ids []int64) (*MailThreads, error) { + mts := &MailThreads{} + if err := c.Read(MailThreadModel, ids, nil, mts); err != nil { + return nil, err + } + return mts, nil +} + +// FindMailThread finds mail.thread record by querying it with criteria. +func (c *Client) FindMailThread(criteria *Criteria) (*MailThread, error) { + mts := &MailThreads{} + if err := c.SearchRead(MailThreadModel, criteria, NewOptions().Limit(1), mts); err != nil { + return nil, err + } + if mts != nil && len(*mts) > 0 { + return &((*mts)[0]), nil + } + return nil, fmt.Errorf("no mail.thread was found with criteria %v", criteria) +} + +// FindMailThreads finds mail.thread records by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailThreads(criteria *Criteria, options *Options) (*MailThreads, error) { + mts := &MailThreads{} + if err := c.SearchRead(MailThreadModel, criteria, options, mts); err != nil { + return nil, err + } + return mts, nil +} + +// FindMailThreadIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailThreadIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(MailThreadModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindMailThreadId finds record id by querying it with criteria. +func (c *Client) FindMailThreadId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(MailThreadModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no mail.thread was found with criteria %v and options %v", criteria, options) +} diff --git a/mail_tracking_value.go b/mail_tracking_value.go new file mode 100644 index 00000000..ed78a98f --- /dev/null +++ b/mail_tracking_value.go @@ -0,0 +1,134 @@ +package odoo + +import ( + "fmt" +) + +// MailTrackingValue represents mail.tracking.value model. +type MailTrackingValue struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Field *String `xmlrpc:"field,omitempty"` + FieldDesc *String `xmlrpc:"field_desc,omitempty"` + FieldType *String `xmlrpc:"field_type,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"` + NewValueMonetary *Float `xmlrpc:"new_value_monetary,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"` + OldValueMonetary *Float `xmlrpc:"old_value_monetary,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) { + return c.Create(MailTrackingValueModel, mtv) +} + +// 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) +} + +// 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 + } + if mtvs != nil && len(*mtvs) > 0 { + return &((*mtvs)[0]), nil + } + return nil, fmt.Errorf("id %v of mail.tracking.value not found", id) +} + +// 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 + } + if mtvs != nil && len(*mtvs) > 0 { + return &((*mtvs)[0]), nil + } + return nil, fmt.Errorf("no mail.tracking.value was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(MailTrackingValueModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no mail.tracking.value was found with criteria %v and options %v", criteria, options) +} diff --git a/mail_wizard_invite.go b/mail_wizard_invite.go new file mode 100644 index 00000000..d256733c --- /dev/null +++ b/mail_wizard_invite.go @@ -0,0 +1,124 @@ +package odoo + +import ( + "fmt" +) + +// MailWizardInvite represents mail.wizard.invite model. +type MailWizardInvite struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + ChannelIds *Relation `xmlrpc:"channel_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"` + Message *String `xmlrpc:"message,omitempty"` + PartnerIds *Relation `xmlrpc:"partner_ids,omitempty"` + ResId *Int `xmlrpc:"res_id,omitempty"` + ResModel *String `xmlrpc:"res_model,omitempty"` + SendMail *Bool `xmlrpc:"send_mail,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) { + return c.Create(MailWizardInviteModel, mwi) +} + +// 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) +} + +// 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 + } + if mwis != nil && len(*mwis) > 0 { + return &((*mwis)[0]), nil + } + return nil, fmt.Errorf("id %v of mail.wizard.invite not found", id) +} + +// 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 + } + if mwis != nil && len(*mwis) > 0 { + return &((*mwis)[0]), nil + } + return nil, fmt.Errorf("no mail.wizard.invite was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(MailWizardInviteModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no mail.wizard.invite was found with criteria %v and options %v", criteria, options) +} diff --git a/payment_acquirer.go b/payment_acquirer.go new file mode 100644 index 00000000..94a14b49 --- /dev/null +++ b/payment_acquirer.go @@ -0,0 +1,153 @@ +package odoo + +import ( + "fmt" +) + +// PaymentAcquirer represents payment.acquirer model. +type PaymentAcquirer struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AuthorizeImplemented *Bool `xmlrpc:"authorize_implemented,omitempty"` + CancelMsg *String `xmlrpc:"cancel_msg,omitempty"` + CaptureManually *Bool `xmlrpc:"capture_manually,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CountryIds *Relation `xmlrpc:"country_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"` + DoneMsg *String `xmlrpc:"done_msg,omitempty"` + Environment *Selection `xmlrpc:"environment,omitempty"` + ErrorMsg *String `xmlrpc:"error_msg,omitempty"` + FeesActive *Bool `xmlrpc:"fees_active,omitempty"` + FeesDomFixed *Float `xmlrpc:"fees_dom_fixed,omitempty"` + FeesDomVar *Float `xmlrpc:"fees_dom_var,omitempty"` + FeesImplemented *Bool `xmlrpc:"fees_implemented,omitempty"` + FeesIntFixed *Float `xmlrpc:"fees_int_fixed,omitempty"` + FeesIntVar *Float `xmlrpc:"fees_int_var,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Image *String `xmlrpc:"image,omitempty"` + ImageMedium *String `xmlrpc:"image_medium,omitempty"` + ImageSmall *String `xmlrpc:"image_small,omitempty"` + JournalId *Many2One `xmlrpc:"journal_id,omitempty"` + ModuleId *Many2One `xmlrpc:"module_id,omitempty"` + ModuleState *Selection `xmlrpc:"module_state,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + PaymentFlow *Selection `xmlrpc:"payment_flow,omitempty"` + PaymentIconIds *Relation `xmlrpc:"payment_icon_ids,omitempty"` + PendingMsg *String `xmlrpc:"pending_msg,omitempty"` + PostMsg *String `xmlrpc:"post_msg,omitempty"` + PreMsg *String `xmlrpc:"pre_msg,omitempty"` + Provider *Selection `xmlrpc:"provider,omitempty"` + RegistrationViewTemplateId *Many2One `xmlrpc:"registration_view_template_id,omitempty"` + SaveToken *Selection `xmlrpc:"save_token,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + SpecificCountries *Bool `xmlrpc:"specific_countries,omitempty"` + TokenImplemented *Bool `xmlrpc:"token_implemented,omitempty"` + ViewTemplateId *Many2One `xmlrpc:"view_template_id,omitempty"` + WebsitePublished *Bool `xmlrpc:"website_published,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// PaymentAcquirers represents array of payment.acquirer model. +type PaymentAcquirers []PaymentAcquirer + +// PaymentAcquirerModel is the odoo model name. +const PaymentAcquirerModel = "payment.acquirer" + +// Many2One convert PaymentAcquirer to *Many2One. +func (pa *PaymentAcquirer) Many2One() *Many2One { + return NewMany2One(pa.Id.Get(), "") +} + +// CreatePaymentAcquirer creates a new payment.acquirer model and returns its id. +func (c *Client) CreatePaymentAcquirer(pa *PaymentAcquirer) (int64, error) { + return c.Create(PaymentAcquirerModel, pa) +} + +// UpdatePaymentAcquirer updates an existing payment.acquirer record. +func (c *Client) UpdatePaymentAcquirer(pa *PaymentAcquirer) error { + return c.UpdatePaymentAcquirers([]int64{pa.Id.Get()}, pa) +} + +// UpdatePaymentAcquirers updates existing payment.acquirer records. +// All records (represented by ids) will be updated by pa values. +func (c *Client) UpdatePaymentAcquirers(ids []int64, pa *PaymentAcquirer) error { + return c.Update(PaymentAcquirerModel, ids, pa) +} + +// DeletePaymentAcquirer deletes an existing payment.acquirer record. +func (c *Client) DeletePaymentAcquirer(id int64) error { + return c.DeletePaymentAcquirers([]int64{id}) +} + +// DeletePaymentAcquirers deletes existing payment.acquirer records. +func (c *Client) DeletePaymentAcquirers(ids []int64) error { + return c.Delete(PaymentAcquirerModel, ids) +} + +// GetPaymentAcquirer gets payment.acquirer existing record. +func (c *Client) GetPaymentAcquirer(id int64) (*PaymentAcquirer, error) { + pas, err := c.GetPaymentAcquirers([]int64{id}) + if err != nil { + return nil, err + } + if pas != nil && len(*pas) > 0 { + return &((*pas)[0]), nil + } + return nil, fmt.Errorf("id %v of payment.acquirer not found", id) +} + +// GetPaymentAcquirers gets payment.acquirer existing records. +func (c *Client) GetPaymentAcquirers(ids []int64) (*PaymentAcquirers, error) { + pas := &PaymentAcquirers{} + if err := c.Read(PaymentAcquirerModel, ids, nil, pas); err != nil { + return nil, err + } + return pas, nil +} + +// FindPaymentAcquirer finds payment.acquirer record by querying it with criteria. +func (c *Client) FindPaymentAcquirer(criteria *Criteria) (*PaymentAcquirer, error) { + pas := &PaymentAcquirers{} + if err := c.SearchRead(PaymentAcquirerModel, criteria, NewOptions().Limit(1), pas); err != nil { + return nil, err + } + if pas != nil && len(*pas) > 0 { + return &((*pas)[0]), nil + } + return nil, fmt.Errorf("no payment.acquirer was found with criteria %v", criteria) +} + +// FindPaymentAcquirers finds payment.acquirer records by querying it +// and filtering it with criteria and options. +func (c *Client) FindPaymentAcquirers(criteria *Criteria, options *Options) (*PaymentAcquirers, error) { + pas := &PaymentAcquirers{} + if err := c.SearchRead(PaymentAcquirerModel, criteria, options, pas); err != nil { + return nil, err + } + return pas, nil +} + +// FindPaymentAcquirerIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindPaymentAcquirerIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(PaymentAcquirerModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindPaymentAcquirerId finds record id by querying it with criteria. +func (c *Client) FindPaymentAcquirerId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(PaymentAcquirerModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no payment.acquirer was found with criteria %v and options %v", criteria, options) +} diff --git a/payment_icon.go b/payment_icon.go new file mode 100644 index 00000000..e1604315 --- /dev/null +++ b/payment_icon.go @@ -0,0 +1,122 @@ +package odoo + +import ( + "fmt" +) + +// PaymentIcon represents payment.icon model. +type PaymentIcon struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AcquirerIds *Relation `xmlrpc:"acquirer_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"` + Image *String `xmlrpc:"image,omitempty"` + ImagePaymentForm *String `xmlrpc:"image_payment_form,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// PaymentIcons represents array of payment.icon model. +type PaymentIcons []PaymentIcon + +// PaymentIconModel is the odoo model name. +const PaymentIconModel = "payment.icon" + +// Many2One convert PaymentIcon to *Many2One. +func (pi *PaymentIcon) Many2One() *Many2One { + return NewMany2One(pi.Id.Get(), "") +} + +// CreatePaymentIcon creates a new payment.icon model and returns its id. +func (c *Client) CreatePaymentIcon(pi *PaymentIcon) (int64, error) { + return c.Create(PaymentIconModel, pi) +} + +// UpdatePaymentIcon updates an existing payment.icon record. +func (c *Client) UpdatePaymentIcon(pi *PaymentIcon) error { + return c.UpdatePaymentIcons([]int64{pi.Id.Get()}, pi) +} + +// UpdatePaymentIcons updates existing payment.icon records. +// All records (represented by ids) will be updated by pi values. +func (c *Client) UpdatePaymentIcons(ids []int64, pi *PaymentIcon) error { + return c.Update(PaymentIconModel, ids, pi) +} + +// DeletePaymentIcon deletes an existing payment.icon record. +func (c *Client) DeletePaymentIcon(id int64) error { + return c.DeletePaymentIcons([]int64{id}) +} + +// DeletePaymentIcons deletes existing payment.icon records. +func (c *Client) DeletePaymentIcons(ids []int64) error { + return c.Delete(PaymentIconModel, ids) +} + +// GetPaymentIcon gets payment.icon existing record. +func (c *Client) GetPaymentIcon(id int64) (*PaymentIcon, error) { + pis, err := c.GetPaymentIcons([]int64{id}) + if err != nil { + return nil, err + } + if pis != nil && len(*pis) > 0 { + return &((*pis)[0]), nil + } + return nil, fmt.Errorf("id %v of payment.icon not found", id) +} + +// GetPaymentIcons gets payment.icon existing records. +func (c *Client) GetPaymentIcons(ids []int64) (*PaymentIcons, error) { + pis := &PaymentIcons{} + if err := c.Read(PaymentIconModel, ids, nil, pis); err != nil { + return nil, err + } + return pis, nil +} + +// FindPaymentIcon finds payment.icon record by querying it with criteria. +func (c *Client) FindPaymentIcon(criteria *Criteria) (*PaymentIcon, error) { + pis := &PaymentIcons{} + if err := c.SearchRead(PaymentIconModel, criteria, NewOptions().Limit(1), pis); err != nil { + return nil, err + } + if pis != nil && len(*pis) > 0 { + return &((*pis)[0]), nil + } + return nil, fmt.Errorf("no payment.icon was found with criteria %v", criteria) +} + +// FindPaymentIcons finds payment.icon records by querying it +// and filtering it with criteria and options. +func (c *Client) FindPaymentIcons(criteria *Criteria, options *Options) (*PaymentIcons, error) { + pis := &PaymentIcons{} + if err := c.SearchRead(PaymentIconModel, criteria, options, pis); err != nil { + return nil, err + } + return pis, nil +} + +// FindPaymentIconIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindPaymentIconIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(PaymentIconModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindPaymentIconId finds record id by querying it with criteria. +func (c *Client) FindPaymentIconId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(PaymentIconModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no payment.icon was found with criteria %v and options %v", criteria, options) +} diff --git a/payment_token.go b/payment_token.go new file mode 100644 index 00000000..f975bbf7 --- /dev/null +++ b/payment_token.go @@ -0,0 +1,126 @@ +package odoo + +import ( + "fmt" +) + +// PaymentToken represents payment.token model. +type PaymentToken struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AcquirerId *Many2One `xmlrpc:"acquirer_id,omitempty"` + AcquirerRef *String `xmlrpc:"acquirer_ref,omitempty"` + 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"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PaymentIds *Relation `xmlrpc:"payment_ids,omitempty"` + ShortName *String `xmlrpc:"short_name,omitempty"` + Verified *Bool `xmlrpc:"verified,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) { + return c.Create(PaymentTokenModel, pt) +} + +// 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) +} + +// 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 + } + if pts != nil && len(*pts) > 0 { + return &((*pts)[0]), nil + } + return nil, fmt.Errorf("id %v of payment.token not found", id) +} + +// 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 + } + if pts != nil && len(*pts) > 0 { + return &((*pts)[0]), nil + } + return nil, fmt.Errorf("no payment.token was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(PaymentTokenModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no payment.token was found with criteria %v and options %v", criteria, options) +} diff --git a/payment_transaction.go b/payment_transaction.go new file mode 100644 index 00000000..294d39e8 --- /dev/null +++ b/payment_transaction.go @@ -0,0 +1,144 @@ +package odoo + +import ( + "fmt" +) + +// PaymentTransaction represents payment.transaction model. +type PaymentTransaction struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AcquirerId *Many2One `xmlrpc:"acquirer_id,omitempty"` + AcquirerReference *String `xmlrpc:"acquirer_reference,omitempty"` + Amount *Float `xmlrpc:"amount,omitempty"` + CallbackHash *String `xmlrpc:"callback_hash,omitempty"` + CallbackMethod *String `xmlrpc:"callback_method,omitempty"` + CallbackModelId *Many2One `xmlrpc:"callback_model_id,omitempty"` + CallbackResId *Int `xmlrpc:"callback_res_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + DateValidate *Time `xmlrpc:"date_validate,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Fees *Float `xmlrpc:"fees,omitempty"` + Html3ds *String `xmlrpc:"html_3ds,omitempty"` + Id *Int `xmlrpc:"id,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"` + PartnerZip *String `xmlrpc:"partner_zip,omitempty"` + PaymentTokenId *Many2One `xmlrpc:"payment_token_id,omitempty"` + Provider *Selection `xmlrpc:"provider,omitempty"` + Reference *String `xmlrpc:"reference,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + StateMessage *String `xmlrpc:"state_message,omitempty"` + Type *Selection `xmlrpc:"type,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) { + return c.Create(PaymentTransactionModel, pt) +} + +// 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) +} + +// 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 + } + if pts != nil && len(*pts) > 0 { + return &((*pts)[0]), nil + } + return nil, fmt.Errorf("id %v of payment.transaction not found", id) +} + +// 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 + } + if pts != nil && len(*pts) > 0 { + return &((*pts)[0]), nil + } + return nil, fmt.Errorf("no payment.transaction was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(PaymentTransactionModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no payment.transaction was found with criteria %v and options %v", criteria, options) +} diff --git a/portal_mixin.go b/portal_mixin.go new file mode 100644 index 00000000..b58daab7 --- /dev/null +++ b/portal_mixin.go @@ -0,0 +1,115 @@ +package odoo + +import ( + "fmt" +) + +// PortalMixin represents portal.mixin model. +type PortalMixin struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + PortalUrl *String `xmlrpc:"portal_url,omitempty"` +} + +// PortalMixins represents array of portal.mixin model. +type PortalMixins []PortalMixin + +// PortalMixinModel is the odoo model name. +const PortalMixinModel = "portal.mixin" + +// Many2One convert PortalMixin to *Many2One. +func (pm *PortalMixin) Many2One() *Many2One { + return NewMany2One(pm.Id.Get(), "") +} + +// CreatePortalMixin creates a new portal.mixin model and returns its id. +func (c *Client) CreatePortalMixin(pm *PortalMixin) (int64, error) { + return c.Create(PortalMixinModel, pm) +} + +// UpdatePortalMixin updates an existing portal.mixin record. +func (c *Client) UpdatePortalMixin(pm *PortalMixin) error { + return c.UpdatePortalMixins([]int64{pm.Id.Get()}, pm) +} + +// UpdatePortalMixins updates existing portal.mixin records. +// All records (represented by ids) will be updated by pm values. +func (c *Client) UpdatePortalMixins(ids []int64, pm *PortalMixin) error { + return c.Update(PortalMixinModel, ids, pm) +} + +// DeletePortalMixin deletes an existing portal.mixin record. +func (c *Client) DeletePortalMixin(id int64) error { + return c.DeletePortalMixins([]int64{id}) +} + +// DeletePortalMixins deletes existing portal.mixin records. +func (c *Client) DeletePortalMixins(ids []int64) error { + return c.Delete(PortalMixinModel, ids) +} + +// GetPortalMixin gets portal.mixin existing record. +func (c *Client) GetPortalMixin(id int64) (*PortalMixin, error) { + pms, err := c.GetPortalMixins([]int64{id}) + if err != nil { + return nil, err + } + if pms != nil && len(*pms) > 0 { + return &((*pms)[0]), nil + } + return nil, fmt.Errorf("id %v of portal.mixin not found", id) +} + +// GetPortalMixins gets portal.mixin existing records. +func (c *Client) GetPortalMixins(ids []int64) (*PortalMixins, error) { + pms := &PortalMixins{} + if err := c.Read(PortalMixinModel, ids, nil, pms); err != nil { + return nil, err + } + return pms, nil +} + +// FindPortalMixin finds portal.mixin record by querying it with criteria. +func (c *Client) FindPortalMixin(criteria *Criteria) (*PortalMixin, error) { + pms := &PortalMixins{} + if err := c.SearchRead(PortalMixinModel, criteria, NewOptions().Limit(1), pms); err != nil { + return nil, err + } + if pms != nil && len(*pms) > 0 { + return &((*pms)[0]), nil + } + return nil, fmt.Errorf("no portal.mixin was found with criteria %v", criteria) +} + +// FindPortalMixins finds portal.mixin records by querying it +// and filtering it with criteria and options. +func (c *Client) FindPortalMixins(criteria *Criteria, options *Options) (*PortalMixins, error) { + pms := &PortalMixins{} + if err := c.SearchRead(PortalMixinModel, criteria, options, pms); err != nil { + return nil, err + } + return pms, nil +} + +// FindPortalMixinIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindPortalMixinIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(PortalMixinModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindPortalMixinId finds record id by querying it with criteria. +func (c *Client) FindPortalMixinId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(PortalMixinModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no portal.mixin was found with criteria %v and options %v", criteria, options) +} diff --git a/portal_wizard.go b/portal_wizard.go new file mode 100644 index 00000000..0124edda --- /dev/null +++ b/portal_wizard.go @@ -0,0 +1,121 @@ +package odoo + +import ( + "fmt" +) + +// PortalWizard represents portal.wizard model. +type PortalWizard struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + PortalId *Many2One `xmlrpc:"portal_id,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) { + return c.Create(PortalWizardModel, pw) +} + +// 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) +} + +// 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 + } + if pws != nil && len(*pws) > 0 { + return &((*pws)[0]), nil + } + return nil, fmt.Errorf("id %v of portal.wizard not found", id) +} + +// 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 + } + if pws != nil && len(*pws) > 0 { + return &((*pws)[0]), nil + } + return nil, fmt.Errorf("no portal.wizard was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(PortalWizardModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no portal.wizard was found with criteria %v and options %v", criteria, options) +} diff --git a/portal_wizard_user.go b/portal_wizard_user.go new file mode 100644 index 00000000..ee1a93f4 --- /dev/null +++ b/portal_wizard_user.go @@ -0,0 +1,123 @@ +package odoo + +import ( + "fmt" +) + +// PortalWizardUser represents portal.wizard.user model. +type PortalWizardUser struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` + InPortal *Bool `xmlrpc:"in_portal,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) { + return c.Create(PortalWizardUserModel, pwu) +} + +// 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) +} + +// 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 + } + if pwus != nil && len(*pwus) > 0 { + return &((*pwus)[0]), nil + } + return nil, fmt.Errorf("id %v of portal.wizard.user not found", id) +} + +// 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 + } + if pwus != nil && len(*pwus) > 0 { + return &((*pwus)[0]), nil + } + return nil, fmt.Errorf("no portal.wizard.user was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(PortalWizardUserModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no portal.wizard.user was found with criteria %v and options %v", criteria, options) +} diff --git a/procurement_group.go b/procurement_group.go new file mode 100644 index 00000000..3db666ff --- /dev/null +++ b/procurement_group.go @@ -0,0 +1,122 @@ +package odoo + +import ( + "fmt" +) + +// ProcurementGroup represents procurement.group model. +type ProcurementGroup struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + MoveType *Selection `xmlrpc:"move_type,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + SaleId *Many2One `xmlrpc:"sale_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ProcurementGroups represents array of procurement.group model. +type ProcurementGroups []ProcurementGroup + +// ProcurementGroupModel is the odoo model name. +const ProcurementGroupModel = "procurement.group" + +// Many2One convert ProcurementGroup to *Many2One. +func (pg *ProcurementGroup) Many2One() *Many2One { + return NewMany2One(pg.Id.Get(), "") +} + +// CreateProcurementGroup creates a new procurement.group model and returns its id. +func (c *Client) CreateProcurementGroup(pg *ProcurementGroup) (int64, error) { + return c.Create(ProcurementGroupModel, pg) +} + +// UpdateProcurementGroup updates an existing procurement.group record. +func (c *Client) UpdateProcurementGroup(pg *ProcurementGroup) error { + return c.UpdateProcurementGroups([]int64{pg.Id.Get()}, pg) +} + +// UpdateProcurementGroups updates existing procurement.group records. +// All records (represented by ids) will be updated by pg values. +func (c *Client) UpdateProcurementGroups(ids []int64, pg *ProcurementGroup) error { + return c.Update(ProcurementGroupModel, ids, pg) +} + +// DeleteProcurementGroup deletes an existing procurement.group record. +func (c *Client) DeleteProcurementGroup(id int64) error { + return c.DeleteProcurementGroups([]int64{id}) +} + +// DeleteProcurementGroups deletes existing procurement.group records. +func (c *Client) DeleteProcurementGroups(ids []int64) error { + return c.Delete(ProcurementGroupModel, ids) +} + +// GetProcurementGroup gets procurement.group existing record. +func (c *Client) GetProcurementGroup(id int64) (*ProcurementGroup, error) { + pgs, err := c.GetProcurementGroups([]int64{id}) + if err != nil { + return nil, err + } + if pgs != nil && len(*pgs) > 0 { + return &((*pgs)[0]), nil + } + return nil, fmt.Errorf("id %v of procurement.group not found", id) +} + +// GetProcurementGroups gets procurement.group existing records. +func (c *Client) GetProcurementGroups(ids []int64) (*ProcurementGroups, error) { + pgs := &ProcurementGroups{} + if err := c.Read(ProcurementGroupModel, ids, nil, pgs); err != nil { + return nil, err + } + return pgs, nil +} + +// FindProcurementGroup finds procurement.group record by querying it with criteria. +func (c *Client) FindProcurementGroup(criteria *Criteria) (*ProcurementGroup, error) { + pgs := &ProcurementGroups{} + if err := c.SearchRead(ProcurementGroupModel, criteria, NewOptions().Limit(1), pgs); err != nil { + return nil, err + } + if pgs != nil && len(*pgs) > 0 { + return &((*pgs)[0]), nil + } + return nil, fmt.Errorf("no procurement.group was found with criteria %v", criteria) +} + +// FindProcurementGroups finds procurement.group records by querying it +// and filtering it with criteria and options. +func (c *Client) FindProcurementGroups(criteria *Criteria, options *Options) (*ProcurementGroups, error) { + pgs := &ProcurementGroups{} + if err := c.SearchRead(ProcurementGroupModel, criteria, options, pgs); err != nil { + return nil, err + } + return pgs, nil +} + +// FindProcurementGroupIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindProcurementGroupIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(ProcurementGroupModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindProcurementGroupId finds record id by querying it with criteria. +func (c *Client) FindProcurementGroupId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ProcurementGroupModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no procurement.group was found with criteria %v and options %v", criteria, options) +} diff --git a/procurement_rule.go b/procurement_rule.go new file mode 100644 index 00000000..1aed67fe --- /dev/null +++ b/procurement_rule.go @@ -0,0 +1,136 @@ +package odoo + +import ( + "fmt" +) + +// ProcurementRule represents procurement.rule model. +type ProcurementRule struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + Action *Selection `xmlrpc:"action,omitempty"` + Active *Bool `xmlrpc:"active,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Delay *Int `xmlrpc:"delay,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + GroupId *Many2One `xmlrpc:"group_id,omitempty"` + GroupPropagationOption *Selection `xmlrpc:"group_propagation_option,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LocationId *Many2One `xmlrpc:"location_id,omitempty"` + LocationSrcId *Many2One `xmlrpc:"location_src_id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + PartnerAddressId *Many2One `xmlrpc:"partner_address_id,omitempty"` + PickingTypeId *Many2One `xmlrpc:"picking_type_id,omitempty"` + ProcureMethod *Selection `xmlrpc:"procure_method,omitempty"` + Propagate *Bool `xmlrpc:"propagate,omitempty"` + PropagateWarehouseId *Many2One `xmlrpc:"propagate_warehouse_id,omitempty"` + RouteId *Many2One `xmlrpc:"route_id,omitempty"` + RouteSequence *Int `xmlrpc:"route_sequence,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + WarehouseId *Many2One `xmlrpc:"warehouse_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ProcurementRules represents array of procurement.rule model. +type ProcurementRules []ProcurementRule + +// ProcurementRuleModel is the odoo model name. +const ProcurementRuleModel = "procurement.rule" + +// Many2One convert ProcurementRule to *Many2One. +func (pr *ProcurementRule) Many2One() *Many2One { + return NewMany2One(pr.Id.Get(), "") +} + +// CreateProcurementRule creates a new procurement.rule model and returns its id. +func (c *Client) CreateProcurementRule(pr *ProcurementRule) (int64, error) { + return c.Create(ProcurementRuleModel, pr) +} + +// UpdateProcurementRule updates an existing procurement.rule record. +func (c *Client) UpdateProcurementRule(pr *ProcurementRule) error { + return c.UpdateProcurementRules([]int64{pr.Id.Get()}, pr) +} + +// UpdateProcurementRules updates existing procurement.rule records. +// All records (represented by ids) will be updated by pr values. +func (c *Client) UpdateProcurementRules(ids []int64, pr *ProcurementRule) error { + return c.Update(ProcurementRuleModel, ids, pr) +} + +// DeleteProcurementRule deletes an existing procurement.rule record. +func (c *Client) DeleteProcurementRule(id int64) error { + return c.DeleteProcurementRules([]int64{id}) +} + +// DeleteProcurementRules deletes existing procurement.rule records. +func (c *Client) DeleteProcurementRules(ids []int64) error { + return c.Delete(ProcurementRuleModel, ids) +} + +// GetProcurementRule gets procurement.rule existing record. +func (c *Client) GetProcurementRule(id int64) (*ProcurementRule, error) { + prs, err := c.GetProcurementRules([]int64{id}) + if err != nil { + return nil, err + } + if prs != nil && len(*prs) > 0 { + return &((*prs)[0]), nil + } + return nil, fmt.Errorf("id %v of procurement.rule not found", id) +} + +// GetProcurementRules gets procurement.rule existing records. +func (c *Client) GetProcurementRules(ids []int64) (*ProcurementRules, error) { + prs := &ProcurementRules{} + if err := c.Read(ProcurementRuleModel, ids, nil, prs); err != nil { + return nil, err + } + return prs, nil +} + +// FindProcurementRule finds procurement.rule record by querying it with criteria. +func (c *Client) FindProcurementRule(criteria *Criteria) (*ProcurementRule, error) { + prs := &ProcurementRules{} + if err := c.SearchRead(ProcurementRuleModel, criteria, NewOptions().Limit(1), prs); err != nil { + return nil, err + } + if prs != nil && len(*prs) > 0 { + return &((*prs)[0]), nil + } + return nil, fmt.Errorf("no procurement.rule was found with criteria %v", criteria) +} + +// FindProcurementRules finds procurement.rule records by querying it +// and filtering it with criteria and options. +func (c *Client) FindProcurementRules(criteria *Criteria, options *Options) (*ProcurementRules, error) { + prs := &ProcurementRules{} + if err := c.SearchRead(ProcurementRuleModel, criteria, options, prs); err != nil { + return nil, err + } + return prs, nil +} + +// FindProcurementRuleIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindProcurementRuleIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(ProcurementRuleModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindProcurementRuleId finds record id by querying it with criteria. +func (c *Client) FindProcurementRuleId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ProcurementRuleModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no procurement.rule was found with criteria %v and options %v", criteria, options) +} diff --git a/product_attribute.go b/product_attribute.go new file mode 100644 index 00000000..5cd8c9b1 --- /dev/null +++ b/product_attribute.go @@ -0,0 +1,123 @@ +package odoo + +import ( + "fmt" +) + +// ProductAttribute represents product.attribute model. +type ProductAttribute struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AttributeLineIds *Relation `xmlrpc:"attribute_line_ids,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CreateVariant *Bool `xmlrpc:"create_variant,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Sequence *Int `xmlrpc:"sequence,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) { + return c.Create(ProductAttributeModel, pa) +} + +// 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) +} + +// 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 + } + if pas != nil && len(*pas) > 0 { + return &((*pas)[0]), nil + } + return nil, fmt.Errorf("id %v of product.attribute not found", id) +} + +// 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 + } + if pas != nil && len(*pas) > 0 { + return &((*pas)[0]), nil + } + return nil, fmt.Errorf("no product.attribute was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(ProductAttributeModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no product.attribute was found with criteria %v and options %v", criteria, options) +} diff --git a/product_attribute_line.go b/product_attribute_line.go new file mode 100644 index 00000000..2ae3d090 --- /dev/null +++ b/product_attribute_line.go @@ -0,0 +1,121 @@ +package odoo + +import ( + "fmt" +) + +// ProductAttributeLine represents product.attribute.line model. +type ProductAttributeLine struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` + 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"` +} + +// ProductAttributeLines represents array of product.attribute.line model. +type ProductAttributeLines []ProductAttributeLine + +// ProductAttributeLineModel is the odoo model name. +const ProductAttributeLineModel = "product.attribute.line" + +// Many2One convert ProductAttributeLine to *Many2One. +func (pal *ProductAttributeLine) Many2One() *Many2One { + return NewMany2One(pal.Id.Get(), "") +} + +// CreateProductAttributeLine creates a new product.attribute.line model and returns its id. +func (c *Client) CreateProductAttributeLine(pal *ProductAttributeLine) (int64, error) { + return c.Create(ProductAttributeLineModel, pal) +} + +// UpdateProductAttributeLine updates an existing product.attribute.line record. +func (c *Client) UpdateProductAttributeLine(pal *ProductAttributeLine) error { + return c.UpdateProductAttributeLines([]int64{pal.Id.Get()}, pal) +} + +// UpdateProductAttributeLines updates existing product.attribute.line records. +// All records (represented by ids) will be updated by pal values. +func (c *Client) UpdateProductAttributeLines(ids []int64, pal *ProductAttributeLine) error { + return c.Update(ProductAttributeLineModel, ids, pal) +} + +// DeleteProductAttributeLine deletes an existing product.attribute.line record. +func (c *Client) DeleteProductAttributeLine(id int64) error { + return c.DeleteProductAttributeLines([]int64{id}) +} + +// DeleteProductAttributeLines deletes existing product.attribute.line records. +func (c *Client) DeleteProductAttributeLines(ids []int64) error { + return c.Delete(ProductAttributeLineModel, ids) +} + +// GetProductAttributeLine gets product.attribute.line existing record. +func (c *Client) GetProductAttributeLine(id int64) (*ProductAttributeLine, error) { + pals, err := c.GetProductAttributeLines([]int64{id}) + if err != nil { + return nil, err + } + if pals != nil && len(*pals) > 0 { + return &((*pals)[0]), nil + } + return nil, fmt.Errorf("id %v of product.attribute.line not found", id) +} + +// GetProductAttributeLines gets product.attribute.line existing records. +func (c *Client) GetProductAttributeLines(ids []int64) (*ProductAttributeLines, error) { + pals := &ProductAttributeLines{} + if err := c.Read(ProductAttributeLineModel, ids, nil, pals); err != nil { + return nil, err + } + return pals, nil +} + +// FindProductAttributeLine finds product.attribute.line record by querying it with criteria. +func (c *Client) FindProductAttributeLine(criteria *Criteria) (*ProductAttributeLine, error) { + pals := &ProductAttributeLines{} + if err := c.SearchRead(ProductAttributeLineModel, criteria, NewOptions().Limit(1), pals); err != nil { + return nil, err + } + if pals != nil && len(*pals) > 0 { + return &((*pals)[0]), nil + } + return nil, fmt.Errorf("no product.attribute.line was found with criteria %v", criteria) +} + +// FindProductAttributeLines finds product.attribute.line records by querying it +// and filtering it with criteria and options. +func (c *Client) FindProductAttributeLines(criteria *Criteria, options *Options) (*ProductAttributeLines, error) { + pals := &ProductAttributeLines{} + if err := c.SearchRead(ProductAttributeLineModel, criteria, options, pals); err != nil { + return nil, err + } + return pals, nil +} + +// FindProductAttributeLineIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindProductAttributeLineIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(ProductAttributeLineModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindProductAttributeLineId finds record id by querying it with criteria. +func (c *Client) FindProductAttributeLineId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ProductAttributeLineModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no product.attribute.line was found with criteria %v and options %v", criteria, options) +} diff --git a/product_attribute_price.go b/product_attribute_price.go new file mode 100644 index 00000000..6333bb1e --- /dev/null +++ b/product_attribute_price.go @@ -0,0 +1,121 @@ +package odoo + +import ( + "fmt" +) + +// ProductAttributePrice represents product.attribute.price model. +type ProductAttributePrice struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + PriceExtra *Float `xmlrpc:"price_extra,omitempty"` + ProductTmplId *Many2One `xmlrpc:"product_tmpl_id,omitempty"` + ValueId *Many2One `xmlrpc:"value_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ProductAttributePrices represents array of product.attribute.price model. +type ProductAttributePrices []ProductAttributePrice + +// ProductAttributePriceModel is the odoo model name. +const ProductAttributePriceModel = "product.attribute.price" + +// Many2One convert ProductAttributePrice to *Many2One. +func (pap *ProductAttributePrice) Many2One() *Many2One { + return NewMany2One(pap.Id.Get(), "") +} + +// CreateProductAttributePrice creates a new product.attribute.price model and returns its id. +func (c *Client) CreateProductAttributePrice(pap *ProductAttributePrice) (int64, error) { + return c.Create(ProductAttributePriceModel, pap) +} + +// UpdateProductAttributePrice updates an existing product.attribute.price record. +func (c *Client) UpdateProductAttributePrice(pap *ProductAttributePrice) error { + return c.UpdateProductAttributePrices([]int64{pap.Id.Get()}, pap) +} + +// UpdateProductAttributePrices updates existing product.attribute.price records. +// All records (represented by ids) will be updated by pap values. +func (c *Client) UpdateProductAttributePrices(ids []int64, pap *ProductAttributePrice) error { + return c.Update(ProductAttributePriceModel, ids, pap) +} + +// DeleteProductAttributePrice deletes an existing product.attribute.price record. +func (c *Client) DeleteProductAttributePrice(id int64) error { + return c.DeleteProductAttributePrices([]int64{id}) +} + +// DeleteProductAttributePrices deletes existing product.attribute.price records. +func (c *Client) DeleteProductAttributePrices(ids []int64) error { + return c.Delete(ProductAttributePriceModel, ids) +} + +// GetProductAttributePrice gets product.attribute.price existing record. +func (c *Client) GetProductAttributePrice(id int64) (*ProductAttributePrice, error) { + paps, err := c.GetProductAttributePrices([]int64{id}) + if err != nil { + return nil, err + } + if paps != nil && len(*paps) > 0 { + return &((*paps)[0]), nil + } + return nil, fmt.Errorf("id %v of product.attribute.price not found", id) +} + +// GetProductAttributePrices gets product.attribute.price existing records. +func (c *Client) GetProductAttributePrices(ids []int64) (*ProductAttributePrices, error) { + paps := &ProductAttributePrices{} + if err := c.Read(ProductAttributePriceModel, ids, nil, paps); err != nil { + return nil, err + } + return paps, nil +} + +// FindProductAttributePrice finds product.attribute.price record by querying it with criteria. +func (c *Client) FindProductAttributePrice(criteria *Criteria) (*ProductAttributePrice, error) { + paps := &ProductAttributePrices{} + if err := c.SearchRead(ProductAttributePriceModel, criteria, NewOptions().Limit(1), paps); err != nil { + return nil, err + } + if paps != nil && len(*paps) > 0 { + return &((*paps)[0]), nil + } + return nil, fmt.Errorf("no product.attribute.price was found with criteria %v", criteria) +} + +// FindProductAttributePrices finds product.attribute.price records by querying it +// and filtering it with criteria and options. +func (c *Client) FindProductAttributePrices(criteria *Criteria, options *Options) (*ProductAttributePrices, error) { + paps := &ProductAttributePrices{} + if err := c.SearchRead(ProductAttributePriceModel, criteria, options, paps); err != nil { + return nil, err + } + return paps, nil +} + +// FindProductAttributePriceIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindProductAttributePriceIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(ProductAttributePriceModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindProductAttributePriceId finds record id by querying it with criteria. +func (c *Client) FindProductAttributePriceId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ProductAttributePriceModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no product.attribute.price was found with criteria %v and options %v", criteria, options) +} diff --git a/product_attribute_value.go b/product_attribute_value.go new file mode 100644 index 00000000..0dacee0d --- /dev/null +++ b/product_attribute_value.go @@ -0,0 +1,124 @@ +package odoo + +import ( + "fmt" +) + +// ProductAttributeValue represents product.attribute.value model. +type ProductAttributeValue struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` + Name *String `xmlrpc:"name,omitempty"` + PriceExtra *Float `xmlrpc:"price_extra,omitempty"` + PriceIds *Relation `xmlrpc:"price_ids,omitempty"` + ProductIds *Relation `xmlrpc:"product_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) { + return c.Create(ProductAttributeValueModel, pav) +} + +// 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) +} + +// 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 + } + if pavs != nil && len(*pavs) > 0 { + return &((*pavs)[0]), nil + } + return nil, fmt.Errorf("id %v of product.attribute.value not found", id) +} + +// 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 + } + if pavs != nil && len(*pavs) > 0 { + return &((*pavs)[0]), nil + } + return nil, fmt.Errorf("no product.attribute.value was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(ProductAttributeValueModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no product.attribute.value was found with criteria %v and options %v", criteria, options) +} diff --git a/product_category.go b/product_category.go new file mode 100644 index 00000000..15ac0d75 --- /dev/null +++ b/product_category.go @@ -0,0 +1,137 @@ +package odoo + +import ( + "fmt" +) + +// ProductCategory represents product.category model. +type ProductCategory struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + ParentId *Many2One `xmlrpc:"parent_id,omitempty"` + ParentLeft *Int `xmlrpc:"parent_left,omitempty"` + ParentRight *Int `xmlrpc:"parent_right,omitempty"` + ProductCount *Int `xmlrpc:"product_count,omitempty"` + PropertyAccountCreditorPriceDifferenceCateg *Many2One `xmlrpc:"property_account_creditor_price_difference_categ,omitempty"` + PropertyAccountExpenseCategId *Many2One `xmlrpc:"property_account_expense_categ_id,omitempty"` + PropertyAccountIncomeCategId *Many2One `xmlrpc:"property_account_income_categ_id,omitempty"` + PropertyCostMethod *Selection `xmlrpc:"property_cost_method,omitempty"` + PropertyStockAccountInputCategId *Many2One `xmlrpc:"property_stock_account_input_categ_id,omitempty"` + PropertyStockAccountOutputCategId *Many2One `xmlrpc:"property_stock_account_output_categ_id,omitempty"` + PropertyStockJournal *Many2One `xmlrpc:"property_stock_journal,omitempty"` + PropertyStockValuationAccountId *Many2One `xmlrpc:"property_stock_valuation_account_id,omitempty"` + PropertyValuation *Selection `xmlrpc:"property_valuation,omitempty"` + RemovalStrategyId *Many2One `xmlrpc:"removal_strategy_id,omitempty"` + RouteIds *Relation `xmlrpc:"route_ids,omitempty"` + TotalRouteIds *Relation `xmlrpc:"total_route_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) { + return c.Create(ProductCategoryModel, pc) +} + +// 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) +} + +// 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 + } + if pcs != nil && len(*pcs) > 0 { + return &((*pcs)[0]), nil + } + return nil, fmt.Errorf("id %v of product.category not found", id) +} + +// 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 + } + if pcs != nil && len(*pcs) > 0 { + return &((*pcs)[0]), nil + } + return nil, fmt.Errorf("no product.category was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(ProductCategoryModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no product.category was found with criteria %v and options %v", criteria, options) +} diff --git a/product_packaging.go b/product_packaging.go new file mode 100644 index 00000000..80a817e9 --- /dev/null +++ b/product_packaging.go @@ -0,0 +1,123 @@ +package odoo + +import ( + "fmt" +) + +// ProductPackaging represents product.packaging model. +type ProductPackaging struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + Barcode *String `xmlrpc:"barcode,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"` + Qty *Float `xmlrpc:"qty,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) { + return c.Create(ProductPackagingModel, pp) +} + +// 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) +} + +// 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 + } + if pps != nil && len(*pps) > 0 { + return &((*pps)[0]), nil + } + return nil, fmt.Errorf("id %v of product.packaging not found", id) +} + +// 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 + } + if pps != nil && len(*pps) > 0 { + return &((*pps)[0]), nil + } + return nil, fmt.Errorf("no product.packaging was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(ProductPackagingModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no product.packaging was found with criteria %v and options %v", criteria, options) +} diff --git a/product_price_history.go b/product_price_history.go new file mode 100644 index 00000000..9d2e5905 --- /dev/null +++ b/product_price_history.go @@ -0,0 +1,122 @@ +package odoo + +import ( + "fmt" +) + +// ProductPriceHistory represents product.price.history model. +type ProductPriceHistory struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + Cost *Float `xmlrpc:"cost,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Datetime *Time `xmlrpc:"datetime,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + ProductId *Many2One `xmlrpc:"product_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ProductPriceHistorys represents array of product.price.history model. +type ProductPriceHistorys []ProductPriceHistory + +// ProductPriceHistoryModel is the odoo model name. +const ProductPriceHistoryModel = "product.price.history" + +// Many2One convert ProductPriceHistory to *Many2One. +func (pph *ProductPriceHistory) Many2One() *Many2One { + return NewMany2One(pph.Id.Get(), "") +} + +// CreateProductPriceHistory creates a new product.price.history model and returns its id. +func (c *Client) CreateProductPriceHistory(pph *ProductPriceHistory) (int64, error) { + return c.Create(ProductPriceHistoryModel, pph) +} + +// UpdateProductPriceHistory updates an existing product.price.history record. +func (c *Client) UpdateProductPriceHistory(pph *ProductPriceHistory) error { + return c.UpdateProductPriceHistorys([]int64{pph.Id.Get()}, pph) +} + +// UpdateProductPriceHistorys updates existing product.price.history records. +// All records (represented by ids) will be updated by pph values. +func (c *Client) UpdateProductPriceHistorys(ids []int64, pph *ProductPriceHistory) error { + return c.Update(ProductPriceHistoryModel, ids, pph) +} + +// DeleteProductPriceHistory deletes an existing product.price.history record. +func (c *Client) DeleteProductPriceHistory(id int64) error { + return c.DeleteProductPriceHistorys([]int64{id}) +} + +// DeleteProductPriceHistorys deletes existing product.price.history records. +func (c *Client) DeleteProductPriceHistorys(ids []int64) error { + return c.Delete(ProductPriceHistoryModel, ids) +} + +// GetProductPriceHistory gets product.price.history existing record. +func (c *Client) GetProductPriceHistory(id int64) (*ProductPriceHistory, error) { + pphs, err := c.GetProductPriceHistorys([]int64{id}) + if err != nil { + return nil, err + } + if pphs != nil && len(*pphs) > 0 { + return &((*pphs)[0]), nil + } + return nil, fmt.Errorf("id %v of product.price.history not found", id) +} + +// GetProductPriceHistorys gets product.price.history existing records. +func (c *Client) GetProductPriceHistorys(ids []int64) (*ProductPriceHistorys, error) { + pphs := &ProductPriceHistorys{} + if err := c.Read(ProductPriceHistoryModel, ids, nil, pphs); err != nil { + return nil, err + } + return pphs, nil +} + +// FindProductPriceHistory finds product.price.history record by querying it with criteria. +func (c *Client) FindProductPriceHistory(criteria *Criteria) (*ProductPriceHistory, error) { + pphs := &ProductPriceHistorys{} + if err := c.SearchRead(ProductPriceHistoryModel, criteria, NewOptions().Limit(1), pphs); err != nil { + return nil, err + } + if pphs != nil && len(*pphs) > 0 { + return &((*pphs)[0]), nil + } + return nil, fmt.Errorf("no product.price.history was found with criteria %v", criteria) +} + +// FindProductPriceHistorys finds product.price.history records by querying it +// and filtering it with criteria and options. +func (c *Client) FindProductPriceHistorys(criteria *Criteria, options *Options) (*ProductPriceHistorys, error) { + pphs := &ProductPriceHistorys{} + if err := c.SearchRead(ProductPriceHistoryModel, criteria, options, pphs); err != nil { + return nil, err + } + return pphs, nil +} + +// FindProductPriceHistoryIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindProductPriceHistoryIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(ProductPriceHistoryModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindProductPriceHistoryId finds record id by querying it with criteria. +func (c *Client) FindProductPriceHistoryId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ProductPriceHistoryModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no product.price.history was found with criteria %v and options %v", criteria, options) +} diff --git a/product_price_list.go b/product_price_list.go new file mode 100644 index 00000000..b2cf277d --- /dev/null +++ b/product_price_list.go @@ -0,0 +1,124 @@ +package odoo + +import ( + "fmt" +) + +// ProductPriceList represents product.price_list model. +type ProductPriceList struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + PriceList *Many2One `xmlrpc:"price_list,omitempty"` + Qty1 *Int `xmlrpc:"qty1,omitempty"` + Qty2 *Int `xmlrpc:"qty2,omitempty"` + Qty3 *Int `xmlrpc:"qty3,omitempty"` + Qty4 *Int `xmlrpc:"qty4,omitempty"` + Qty5 *Int `xmlrpc:"qty5,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ProductPriceLists represents array of product.price_list model. +type ProductPriceLists []ProductPriceList + +// ProductPriceListModel is the odoo model name. +const ProductPriceListModel = "product.price_list" + +// Many2One convert ProductPriceList to *Many2One. +func (pp *ProductPriceList) Many2One() *Many2One { + return NewMany2One(pp.Id.Get(), "") +} + +// CreateProductPriceList creates a new product.price_list model and returns its id. +func (c *Client) CreateProductPriceList(pp *ProductPriceList) (int64, error) { + return c.Create(ProductPriceListModel, pp) +} + +// UpdateProductPriceList updates an existing product.price_list record. +func (c *Client) UpdateProductPriceList(pp *ProductPriceList) error { + return c.UpdateProductPriceLists([]int64{pp.Id.Get()}, pp) +} + +// UpdateProductPriceLists updates existing product.price_list 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) +} + +// DeleteProductPriceList deletes an existing product.price_list record. +func (c *Client) DeleteProductPriceList(id int64) error { + return c.DeleteProductPriceLists([]int64{id}) +} + +// DeleteProductPriceLists deletes existing product.price_list records. +func (c *Client) DeleteProductPriceLists(ids []int64) error { + return c.Delete(ProductPriceListModel, ids) +} + +// GetProductPriceList gets product.price_list existing record. +func (c *Client) GetProductPriceList(id int64) (*ProductPriceList, error) { + pps, err := c.GetProductPriceLists([]int64{id}) + if err != nil { + return nil, err + } + if pps != nil && len(*pps) > 0 { + return &((*pps)[0]), nil + } + return nil, fmt.Errorf("id %v of product.price_list not found", id) +} + +// GetProductPriceLists gets product.price_list 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.price_list 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 + } + if pps != nil && len(*pps) > 0 { + return &((*pps)[0]), nil + } + return nil, fmt.Errorf("no product.price_list was found with criteria %v", criteria) +} + +// FindProductPriceLists finds product.price_list 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) { + ids, err := c.Search(ProductPriceListModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no product.price_list was found with criteria %v and options %v", criteria, options) +} diff --git a/product_pricelist.go b/product_pricelist.go new file mode 100644 index 00000000..094f6ae6 --- /dev/null +++ b/product_pricelist.go @@ -0,0 +1,126 @@ +package odoo + +import ( + "fmt" +) + +// ProductPricelist represents product.pricelist model. +type ProductPricelist struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + Active *Bool `xmlrpc:"active,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"` + DiscountPolicy *Selection `xmlrpc:"discount_policy,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + ItemIds *Relation `xmlrpc:"item_ids,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Sequence *Int `xmlrpc:"sequence,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) { + return c.Create(ProductPricelistModel, pp) +} + +// 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) +} + +// 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 + } + if pps != nil && len(*pps) > 0 { + return &((*pps)[0]), nil + } + return nil, fmt.Errorf("id %v of product.pricelist not found", id) +} + +// 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 + } + if pps != nil && len(*pps) > 0 { + return &((*pps)[0]), nil + } + return nil, fmt.Errorf("no product.pricelist was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(ProductPricelistModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no product.pricelist was found with criteria %v and options %v", criteria, options) +} diff --git a/product_pricelist_item.go b/product_pricelist_item.go new file mode 100644 index 00000000..acef69ef --- /dev/null +++ b/product_pricelist_item.go @@ -0,0 +1,140 @@ +package odoo + +import ( + "fmt" +) + +// ProductPricelistItem represents product.pricelist.item model. +type ProductPricelistItem struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + FixedPrice *Float `xmlrpc:"fixed_price,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + MinQuantity *Int `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"` + 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"` + 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) { + return c.Create(ProductPricelistItemModel, ppi) +} + +// 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) +} + +// 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 + } + if ppis != nil && len(*ppis) > 0 { + return &((*ppis)[0]), nil + } + return nil, fmt.Errorf("id %v of product.pricelist.item not found", id) +} + +// 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 + } + if ppis != nil && len(*ppis) > 0 { + return &((*ppis)[0]), nil + } + return nil, fmt.Errorf("no product.pricelist.item was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(ProductPricelistItemModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no product.pricelist.item was found with criteria %v and options %v", criteria, options) +} diff --git a/product_product.go b/product_product.go index 19a76aef..10686fd8 100644 --- a/product_product.go +++ b/product_product.go @@ -6,124 +6,124 @@ import ( // ProductProduct represents product.product model. type ProductProduct struct { - LastUpdate *Time `xmlrpc:"__last_update,omptempty"` - Active *Bool `xmlrpc:"active,omptempty"` - ActivityDateDeadline *Time `xmlrpc:"activity_date_deadline,omptempty"` - ActivityIds *Relation `xmlrpc:"activity_ids,omptempty"` - ActivityState *Selection `xmlrpc:"activity_state,omptempty"` - ActivitySummary *String `xmlrpc:"activity_summary,omptempty"` - ActivityTypeId *Many2One `xmlrpc:"activity_type_id,omptempty"` - ActivityUserId *Many2One `xmlrpc:"activity_user_id,omptempty"` - AttributeLineIds *Relation `xmlrpc:"attribute_line_ids,omptempty"` - AttributeValueIds *Relation `xmlrpc:"attribute_value_ids,omptempty"` - Barcode *String `xmlrpc:"barcode,omptempty"` - CategId *Many2One `xmlrpc:"categ_id,omptempty"` - Code *String `xmlrpc:"code,omptempty"` - Color *Int `xmlrpc:"color,omptempty"` - CompanyId *Many2One `xmlrpc:"company_id,omptempty"` - CostMethod *String `xmlrpc:"cost_method,omptempty"` - CreateDate *Time `xmlrpc:"create_date,omptempty"` - CreateUid *Many2One `xmlrpc:"create_uid,omptempty"` - CurrencyId *Many2One `xmlrpc:"currency_id,omptempty"` - DefaultCode *String `xmlrpc:"default_code,omptempty"` - Description *String `xmlrpc:"description,omptempty"` - DescriptionPicking *String `xmlrpc:"description_picking,omptempty"` - DescriptionPickingin *String `xmlrpc:"description_pickingin,omptempty"` - DescriptionPickingout *String `xmlrpc:"description_pickingout,omptempty"` - DescriptionPurchase *String `xmlrpc:"description_purchase,omptempty"` - DescriptionSale *String `xmlrpc:"description_sale,omptempty"` - DisplayName *String `xmlrpc:"display_name,omptempty"` - ExpensePolicy *Selection `xmlrpc:"expense_policy,omptempty"` - Id *Int `xmlrpc:"id,omptempty"` - Image *String `xmlrpc:"image,omptempty"` - ImageMedium *String `xmlrpc:"image_medium,omptempty"` - ImageSmall *String `xmlrpc:"image_small,omptempty"` - ImageVariant *String `xmlrpc:"image_variant,omptempty"` - IncomingQty *Float `xmlrpc:"incoming_qty,omptempty"` - InvoicePolicy *Selection `xmlrpc:"invoice_policy,omptempty"` - IsProductVariant *Bool `xmlrpc:"is_product_variant,omptempty"` - ItemIds *Relation `xmlrpc:"item_ids,omptempty"` - ListPrice *Float `xmlrpc:"list_price,omptempty"` - LocationId *Many2One `xmlrpc:"location_id,omptempty"` - LstPrice *Float `xmlrpc:"lst_price,omptempty"` - MessageChannelIds *Relation `xmlrpc:"message_channel_ids,omptempty"` - MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omptempty"` - MessageIds *Relation `xmlrpc:"message_ids,omptempty"` - MessageIsFollower *Bool `xmlrpc:"message_is_follower,omptempty"` - MessageLastPost *Time `xmlrpc:"message_last_post,omptempty"` - MessageNeedaction *Bool `xmlrpc:"message_needaction,omptempty"` - MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omptempty"` - MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omptempty"` - MessageUnread *Bool `xmlrpc:"message_unread,omptempty"` - MessageUnreadCounter *Int `xmlrpc:"message_unread_counter,omptempty"` - Name *String `xmlrpc:"name,omptempty"` - NbrReorderingRules *Int `xmlrpc:"nbr_reordering_rules,omptempty"` - OrderpointIds *Relation `xmlrpc:"orderpoint_ids,omptempty"` - OutgoingQty *Float `xmlrpc:"outgoing_qty,omptempty"` - PackagingIds *Relation `xmlrpc:"packaging_ids,omptempty"` - PartnerRef *String `xmlrpc:"partner_ref,omptempty"` - Price *Float `xmlrpc:"price,omptempty"` - PriceExtra *Float `xmlrpc:"price_extra,omptempty"` - PricelistId *Many2One `xmlrpc:"pricelist_id,omptempty"` - PricelistItemIds *Relation `xmlrpc:"pricelist_item_ids,omptempty"` - ProductTmplId *Many2One `xmlrpc:"product_tmpl_id,omptempty"` - ProductVariantCount *Int `xmlrpc:"product_variant_count,omptempty"` - ProductVariantId *Many2One `xmlrpc:"product_variant_id,omptempty"` - ProductVariantIds *Relation `xmlrpc:"product_variant_ids,omptempty"` - ProjectId *Many2One `xmlrpc:"project_id,omptempty"` - PropertyAccountCreditorPriceDifference *Many2One `xmlrpc:"property_account_creditor_price_difference,omptempty"` - PropertyAccountExpenseId *Many2One `xmlrpc:"property_account_expense_id,omptempty"` - PropertyAccountIncomeId *Many2One `xmlrpc:"property_account_income_id,omptempty"` - PropertyCostMethod *Selection `xmlrpc:"property_cost_method,omptempty"` - PropertyStockAccountInput *Many2One `xmlrpc:"property_stock_account_input,omptempty"` - PropertyStockAccountOutput *Many2One `xmlrpc:"property_stock_account_output,omptempty"` - PropertyStockInventory *Many2One `xmlrpc:"property_stock_inventory,omptempty"` - PropertyStockProduction *Many2One `xmlrpc:"property_stock_production,omptempty"` - PropertyValuation *Selection `xmlrpc:"property_valuation,omptempty"` - PurchaseCount *Int `xmlrpc:"purchase_count,omptempty"` - PurchaseLineWarn *Selection `xmlrpc:"purchase_line_warn,omptempty"` - PurchaseLineWarnMsg *String `xmlrpc:"purchase_line_warn_msg,omptempty"` - PurchaseMethod *Selection `xmlrpc:"purchase_method,omptempty"` - PurchaseOk *Bool `xmlrpc:"purchase_ok,omptempty"` - QtyAtDate *Float `xmlrpc:"qty_at_date,omptempty"` - QtyAvailable *Float `xmlrpc:"qty_available,omptempty"` - Rental *Bool `xmlrpc:"rental,omptempty"` - ReorderingMaxQty *Float `xmlrpc:"reordering_max_qty,omptempty"` - ReorderingMinQty *Float `xmlrpc:"reordering_min_qty,omptempty"` - ResponsibleId *Many2One `xmlrpc:"responsible_id,omptempty"` - RouteFromCategIds *Relation `xmlrpc:"route_from_categ_ids,omptempty"` - RouteIds *Relation `xmlrpc:"route_ids,omptempty"` - SaleDelay *Float `xmlrpc:"sale_delay,omptempty"` - SaleLineWarn *Selection `xmlrpc:"sale_line_warn,omptempty"` - SaleLineWarnMsg *String `xmlrpc:"sale_line_warn_msg,omptempty"` - SaleOk *Bool `xmlrpc:"sale_ok,omptempty"` - SalesCount *Int `xmlrpc:"sales_count,omptempty"` - SellerIds *Relation `xmlrpc:"seller_ids,omptempty"` - Sequence *Int `xmlrpc:"sequence,omptempty"` - ServicePolicy *Selection `xmlrpc:"service_policy,omptempty"` - ServiceTracking *Selection `xmlrpc:"service_tracking,omptempty"` - ServiceType *Selection `xmlrpc:"service_type,omptempty"` - StandardPrice *Float `xmlrpc:"standard_price,omptempty"` - StockFifoManualMoveIds *Relation `xmlrpc:"stock_fifo_manual_move_ids,omptempty"` - StockFifoRealTimeAmlIds *Relation `xmlrpc:"stock_fifo_real_time_aml_ids,omptempty"` - StockMoveIds *Relation `xmlrpc:"stock_move_ids,omptempty"` - StockQuantIds *Relation `xmlrpc:"stock_quant_ids,omptempty"` - StockValue *Float `xmlrpc:"stock_value,omptempty"` - SupplierTaxesId *Relation `xmlrpc:"supplier_taxes_id,omptempty"` - TaxesId *Relation `xmlrpc:"taxes_id,omptempty"` - Tracking *Selection `xmlrpc:"tracking,omptempty"` - Type *Selection `xmlrpc:"type,omptempty"` - UomId *Many2One `xmlrpc:"uom_id,omptempty"` - UomPoId *Many2One `xmlrpc:"uom_po_id,omptempty"` - Valuation *String `xmlrpc:"valuation,omptempty"` - VariantSellerIds *Relation `xmlrpc:"variant_seller_ids,omptempty"` - VirtualAvailable *Float `xmlrpc:"virtual_available,omptempty"` - Volume *Float `xmlrpc:"volume,omptempty"` - WarehouseId *Many2One `xmlrpc:"warehouse_id,omptempty"` - WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omptempty"` - Weight *Float `xmlrpc:"weight,omptempty"` - WriteDate *Time `xmlrpc:"write_date,omptempty"` - WriteUid *Many2One `xmlrpc:"write_uid,omptempty"` + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + Active *Bool `xmlrpc:"active,omitempty"` + ActivityDateDeadline *Time `xmlrpc:"activity_date_deadline,omitempty"` + ActivityIds *Relation `xmlrpc:"activity_ids,omitempty"` + ActivityState *Selection `xmlrpc:"activity_state,omitempty"` + ActivitySummary *String `xmlrpc:"activity_summary,omitempty"` + ActivityTypeId *Many2One `xmlrpc:"activity_type_id,omitempty"` + ActivityUserId *Many2One `xmlrpc:"activity_user_id,omitempty"` + AttributeLineIds *Relation `xmlrpc:"attribute_line_ids,omitempty"` + AttributeValueIds *Relation `xmlrpc:"attribute_value_ids,omitempty"` + Barcode *String `xmlrpc:"barcode,omitempty"` + CategId *Many2One `xmlrpc:"categ_id,omitempty"` + Code *String `xmlrpc:"code,omitempty"` + Color *Int `xmlrpc:"color,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CostMethod *String `xmlrpc:"cost_method,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"` + DescriptionPicking *String `xmlrpc:"description_picking,omitempty"` + DescriptionPickingin *String `xmlrpc:"description_pickingin,omitempty"` + DescriptionPickingout *String `xmlrpc:"description_pickingout,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"` + Id *Int `xmlrpc:"id,omitempty"` + Image *String `xmlrpc:"image,omitempty"` + ImageMedium *String `xmlrpc:"image_medium,omitempty"` + ImageSmall *String `xmlrpc:"image_small,omitempty"` + ImageVariant *String `xmlrpc:"image_variant,omitempty"` + IncomingQty *Float `xmlrpc:"incoming_qty,omitempty"` + InvoicePolicy *Selection `xmlrpc:"invoice_policy,omitempty"` + IsProductVariant *Bool `xmlrpc:"is_product_variant,omitempty"` + ItemIds *Relation `xmlrpc:"item_ids,omitempty"` + ListPrice *Float `xmlrpc:"list_price,omitempty"` + LocationId *Many2One `xmlrpc:"location_id,omitempty"` + LstPrice *Float `xmlrpc:"lst_price,omitempty"` + MessageChannelIds *Relation `xmlrpc:"message_channel_ids,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageLastPost *Time `xmlrpc:"message_last_post,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MessageUnread *Bool `xmlrpc:"message_unread,omitempty"` + MessageUnreadCounter *Int `xmlrpc:"message_unread_counter,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + NbrReorderingRules *Int `xmlrpc:"nbr_reordering_rules,omitempty"` + OrderpointIds *Relation `xmlrpc:"orderpoint_ids,omitempty"` + OutgoingQty *Float `xmlrpc:"outgoing_qty,omitempty"` + PackagingIds *Relation `xmlrpc:"packaging_ids,omitempty"` + PartnerRef *String `xmlrpc:"partner_ref,omitempty"` + Price *Float `xmlrpc:"price,omitempty"` + PriceExtra *Float `xmlrpc:"price_extra,omitempty"` + PricelistId *Many2One `xmlrpc:"pricelist_id,omitempty"` + PricelistItemIds *Relation `xmlrpc:"pricelist_item_ids,omitempty"` + ProductTmplId *Many2One `xmlrpc:"product_tmpl_id,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"` + PropertyAccountCreditorPriceDifference *Many2One `xmlrpc:"property_account_creditor_price_difference,omitempty"` + PropertyAccountExpenseId *Many2One `xmlrpc:"property_account_expense_id,omitempty"` + PropertyAccountIncomeId *Many2One `xmlrpc:"property_account_income_id,omitempty"` + PropertyCostMethod *Selection `xmlrpc:"property_cost_method,omitempty"` + PropertyStockAccountInput *Many2One `xmlrpc:"property_stock_account_input,omitempty"` + PropertyStockAccountOutput *Many2One `xmlrpc:"property_stock_account_output,omitempty"` + PropertyStockInventory *Many2One `xmlrpc:"property_stock_inventory,omitempty"` + PropertyStockProduction *Many2One `xmlrpc:"property_stock_production,omitempty"` + PropertyValuation *Selection `xmlrpc:"property_valuation,omitempty"` + PurchaseCount *Int `xmlrpc:"purchase_count,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"` + QtyAtDate *Float `xmlrpc:"qty_at_date,omitempty"` + QtyAvailable *Float `xmlrpc:"qty_available,omitempty"` + Rental *Bool `xmlrpc:"rental,omitempty"` + ReorderingMaxQty *Float `xmlrpc:"reordering_max_qty,omitempty"` + ReorderingMinQty *Float `xmlrpc:"reordering_min_qty,omitempty"` + ResponsibleId *Many2One `xmlrpc:"responsible_id,omitempty"` + RouteFromCategIds *Relation `xmlrpc:"route_from_categ_ids,omitempty"` + RouteIds *Relation `xmlrpc:"route_ids,omitempty"` + SaleDelay *Float `xmlrpc:"sale_delay,omitempty"` + SaleLineWarn *Selection `xmlrpc:"sale_line_warn,omitempty"` + SaleLineWarnMsg *String `xmlrpc:"sale_line_warn_msg,omitempty"` + SaleOk *Bool `xmlrpc:"sale_ok,omitempty"` + SalesCount *Int `xmlrpc:"sales_count,omitempty"` + SellerIds *Relation `xmlrpc:"seller_ids,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + ServicePolicy *Selection `xmlrpc:"service_policy,omitempty"` + ServiceTracking *Selection `xmlrpc:"service_tracking,omitempty"` + ServiceType *Selection `xmlrpc:"service_type,omitempty"` + StandardPrice *Float `xmlrpc:"standard_price,omitempty"` + StockFifoManualMoveIds *Relation `xmlrpc:"stock_fifo_manual_move_ids,omitempty"` + StockFifoRealTimeAmlIds *Relation `xmlrpc:"stock_fifo_real_time_aml_ids,omitempty"` + StockMoveIds *Relation `xmlrpc:"stock_move_ids,omitempty"` + StockQuantIds *Relation `xmlrpc:"stock_quant_ids,omitempty"` + StockValue *Float `xmlrpc:"stock_value,omitempty"` + SupplierTaxesId *Relation `xmlrpc:"supplier_taxes_id,omitempty"` + TaxesId *Relation `xmlrpc:"taxes_id,omitempty"` + Tracking *Selection `xmlrpc:"tracking,omitempty"` + Type *Selection `xmlrpc:"type,omitempty"` + UomId *Many2One `xmlrpc:"uom_id,omitempty"` + UomPoId *Many2One `xmlrpc:"uom_po_id,omitempty"` + Valuation *String `xmlrpc:"valuation,omitempty"` + VariantSellerIds *Relation `xmlrpc:"variant_seller_ids,omitempty"` + VirtualAvailable *Float `xmlrpc:"virtual_available,omitempty"` + Volume *Float `xmlrpc:"volume,omitempty"` + WarehouseId *Many2One `xmlrpc:"warehouse_id,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + Weight *Float `xmlrpc:"weight,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` } // ProductProducts represents array of product.product model. @@ -193,7 +193,7 @@ func (c *Client) FindProductProduct(criteria *Criteria) (*ProductProduct, error) if pps != nil && len(*pps) > 0 { return &((*pps)[0]), nil } - return nil, fmt.Errorf("product.product was not found") + return nil, fmt.Errorf("no product.product was found with criteria %v", criteria) } // FindProductProducts finds product.product records by querying it @@ -225,5 +225,5 @@ func (c *Client) FindProductProductId(criteria *Criteria, options *Options) (int if len(ids) > 0 { return ids[0], nil } - return -1, fmt.Errorf("product.product was not found") + return -1, fmt.Errorf("no product.product was found with criteria %v and options %v", criteria, options) } diff --git a/product_putaway.go b/product_putaway.go new file mode 100644 index 00000000..4a19dc22 --- /dev/null +++ b/product_putaway.go @@ -0,0 +1,120 @@ +package odoo + +import ( + "fmt" +) + +// ProductPutaway represents product.putaway model. +type ProductPutaway struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + FixedLocationIds *Relation `xmlrpc:"fixed_location_ids,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ProductPutaways represents array of product.putaway model. +type ProductPutaways []ProductPutaway + +// ProductPutawayModel is the odoo model name. +const ProductPutawayModel = "product.putaway" + +// Many2One convert ProductPutaway to *Many2One. +func (pp *ProductPutaway) Many2One() *Many2One { + return NewMany2One(pp.Id.Get(), "") +} + +// CreateProductPutaway creates a new product.putaway model and returns its id. +func (c *Client) CreateProductPutaway(pp *ProductPutaway) (int64, error) { + return c.Create(ProductPutawayModel, pp) +} + +// UpdateProductPutaway updates an existing product.putaway record. +func (c *Client) UpdateProductPutaway(pp *ProductPutaway) error { + return c.UpdateProductPutaways([]int64{pp.Id.Get()}, pp) +} + +// UpdateProductPutaways updates existing product.putaway records. +// All records (represented by ids) will be updated by pp values. +func (c *Client) UpdateProductPutaways(ids []int64, pp *ProductPutaway) error { + return c.Update(ProductPutawayModel, ids, pp) +} + +// DeleteProductPutaway deletes an existing product.putaway record. +func (c *Client) DeleteProductPutaway(id int64) error { + return c.DeleteProductPutaways([]int64{id}) +} + +// DeleteProductPutaways deletes existing product.putaway records. +func (c *Client) DeleteProductPutaways(ids []int64) error { + return c.Delete(ProductPutawayModel, ids) +} + +// GetProductPutaway gets product.putaway existing record. +func (c *Client) GetProductPutaway(id int64) (*ProductPutaway, error) { + pps, err := c.GetProductPutaways([]int64{id}) + if err != nil { + return nil, err + } + if pps != nil && len(*pps) > 0 { + return &((*pps)[0]), nil + } + return nil, fmt.Errorf("id %v of product.putaway not found", id) +} + +// GetProductPutaways gets product.putaway existing records. +func (c *Client) GetProductPutaways(ids []int64) (*ProductPutaways, error) { + pps := &ProductPutaways{} + if err := c.Read(ProductPutawayModel, ids, nil, pps); err != nil { + return nil, err + } + return pps, nil +} + +// FindProductPutaway finds product.putaway record by querying it with criteria. +func (c *Client) FindProductPutaway(criteria *Criteria) (*ProductPutaway, error) { + pps := &ProductPutaways{} + if err := c.SearchRead(ProductPutawayModel, criteria, NewOptions().Limit(1), pps); err != nil { + return nil, err + } + if pps != nil && len(*pps) > 0 { + return &((*pps)[0]), nil + } + return nil, fmt.Errorf("no product.putaway was found with criteria %v", criteria) +} + +// FindProductPutaways finds product.putaway records by querying it +// and filtering it with criteria and options. +func (c *Client) FindProductPutaways(criteria *Criteria, options *Options) (*ProductPutaways, error) { + pps := &ProductPutaways{} + if err := c.SearchRead(ProductPutawayModel, criteria, options, pps); err != nil { + return nil, err + } + return pps, nil +} + +// FindProductPutawayIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindProductPutawayIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(ProductPutawayModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindProductPutawayId finds record id by querying it with criteria. +func (c *Client) FindProductPutawayId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ProductPutawayModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no product.putaway was found with criteria %v and options %v", criteria, options) +} diff --git a/product_removal.go b/product_removal.go new file mode 100644 index 00000000..36a5f33c --- /dev/null +++ b/product_removal.go @@ -0,0 +1,120 @@ +package odoo + +import ( + "fmt" +) + +// ProductRemoval represents product.removal model. +type ProductRemoval struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Method *String `xmlrpc:"method,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ProductRemovals represents array of product.removal model. +type ProductRemovals []ProductRemoval + +// ProductRemovalModel is the odoo model name. +const ProductRemovalModel = "product.removal" + +// Many2One convert ProductRemoval to *Many2One. +func (pr *ProductRemoval) Many2One() *Many2One { + return NewMany2One(pr.Id.Get(), "") +} + +// CreateProductRemoval creates a new product.removal model and returns its id. +func (c *Client) CreateProductRemoval(pr *ProductRemoval) (int64, error) { + return c.Create(ProductRemovalModel, pr) +} + +// UpdateProductRemoval updates an existing product.removal record. +func (c *Client) UpdateProductRemoval(pr *ProductRemoval) error { + return c.UpdateProductRemovals([]int64{pr.Id.Get()}, pr) +} + +// UpdateProductRemovals updates existing product.removal records. +// All records (represented by ids) will be updated by pr values. +func (c *Client) UpdateProductRemovals(ids []int64, pr *ProductRemoval) error { + return c.Update(ProductRemovalModel, ids, pr) +} + +// DeleteProductRemoval deletes an existing product.removal record. +func (c *Client) DeleteProductRemoval(id int64) error { + return c.DeleteProductRemovals([]int64{id}) +} + +// DeleteProductRemovals deletes existing product.removal records. +func (c *Client) DeleteProductRemovals(ids []int64) error { + return c.Delete(ProductRemovalModel, ids) +} + +// GetProductRemoval gets product.removal existing record. +func (c *Client) GetProductRemoval(id int64) (*ProductRemoval, error) { + prs, err := c.GetProductRemovals([]int64{id}) + if err != nil { + return nil, err + } + if prs != nil && len(*prs) > 0 { + return &((*prs)[0]), nil + } + return nil, fmt.Errorf("id %v of product.removal not found", id) +} + +// GetProductRemovals gets product.removal existing records. +func (c *Client) GetProductRemovals(ids []int64) (*ProductRemovals, error) { + prs := &ProductRemovals{} + if err := c.Read(ProductRemovalModel, ids, nil, prs); err != nil { + return nil, err + } + return prs, nil +} + +// FindProductRemoval finds product.removal record by querying it with criteria. +func (c *Client) FindProductRemoval(criteria *Criteria) (*ProductRemoval, error) { + prs := &ProductRemovals{} + if err := c.SearchRead(ProductRemovalModel, criteria, NewOptions().Limit(1), prs); err != nil { + return nil, err + } + if prs != nil && len(*prs) > 0 { + return &((*prs)[0]), nil + } + return nil, fmt.Errorf("no product.removal was found with criteria %v", criteria) +} + +// FindProductRemovals finds product.removal records by querying it +// and filtering it with criteria and options. +func (c *Client) FindProductRemovals(criteria *Criteria, options *Options) (*ProductRemovals, error) { + prs := &ProductRemovals{} + if err := c.SearchRead(ProductRemovalModel, criteria, options, prs); err != nil { + return nil, err + } + return prs, nil +} + +// FindProductRemovalIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindProductRemovalIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(ProductRemovalModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindProductRemovalId finds record id by querying it with criteria. +func (c *Client) FindProductRemovalId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ProductRemovalModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no product.removal was found with criteria %v and options %v", criteria, options) +} diff --git a/product_supplierinfo.go b/product_supplierinfo.go index 5ca4c3b2..f32961f0 100644 --- a/product_supplierinfo.go +++ b/product_supplierinfo.go @@ -6,28 +6,28 @@ import ( // ProductSupplierinfo represents product.supplierinfo model. type ProductSupplierinfo struct { - LastUpdate *Time `xmlrpc:"__last_update,omptempty"` - CompanyId *Many2One `xmlrpc:"company_id,omptempty"` - CreateDate *Time `xmlrpc:"create_date,omptempty"` - CreateUid *Many2One `xmlrpc:"create_uid,omptempty"` - CurrencyId *Many2One `xmlrpc:"currency_id,omptempty"` - DateEnd *Time `xmlrpc:"date_end,omptempty"` - DateStart *Time `xmlrpc:"date_start,omptempty"` - Delay *Int `xmlrpc:"delay,omptempty"` - DisplayName *String `xmlrpc:"display_name,omptempty"` - Id *Int `xmlrpc:"id,omptempty"` - MinQty *Float `xmlrpc:"min_qty,omptempty"` - Name *Many2One `xmlrpc:"name,omptempty"` - Price *Float `xmlrpc:"price,omptempty"` - ProductCode *String `xmlrpc:"product_code,omptempty"` - ProductId *Many2One `xmlrpc:"product_id,omptempty"` - ProductName *String `xmlrpc:"product_name,omptempty"` - ProductTmplId *Many2One `xmlrpc:"product_tmpl_id,omptempty"` - ProductUom *Many2One `xmlrpc:"product_uom,omptempty"` - ProductVariantCount *Int `xmlrpc:"product_variant_count,omptempty"` - Sequence *Int `xmlrpc:"sequence,omptempty"` - WriteDate *Time `xmlrpc:"write_date,omptempty"` - WriteUid *Many2One `xmlrpc:"write_uid,omptempty"` + LastUpdate *Time `xmlrpc:"__last_update,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"` + DateEnd *Time `xmlrpc:"date_end,omitempty"` + DateStart *Time `xmlrpc:"date_start,omitempty"` + Delay *Int `xmlrpc:"delay,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + MinQty *Float `xmlrpc:"min_qty,omitempty"` + Name *Many2One `xmlrpc:"name,omitempty"` + Price *Float `xmlrpc:"price,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. @@ -97,7 +97,7 @@ func (c *Client) FindProductSupplierinfo(criteria *Criteria) (*ProductSupplierin if pss != nil && len(*pss) > 0 { return &((*pss)[0]), nil } - return nil, fmt.Errorf("product.supplierinfo was not found") + return nil, fmt.Errorf("no product.supplierinfo was found with criteria %v", criteria) } // FindProductSupplierinfos finds product.supplierinfo records by querying it @@ -129,5 +129,5 @@ func (c *Client) FindProductSupplierinfoId(criteria *Criteria, options *Options) if len(ids) > 0 { return ids[0], nil } - return -1, fmt.Errorf("product.supplierinfo was not found") + return -1, fmt.Errorf("no product.supplierinfo was found with criteria %v and options %v", criteria, options) } diff --git a/product_template.go b/product_template.go new file mode 100644 index 00000000..37f288da --- /dev/null +++ b/product_template.go @@ -0,0 +1,215 @@ +package odoo + +import ( + "fmt" +) + +// ProductTemplate represents product.template model. +type ProductTemplate struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + Active *Bool `xmlrpc:"active,omitempty"` + ActivityDateDeadline *Time `xmlrpc:"activity_date_deadline,omitempty"` + ActivityIds *Relation `xmlrpc:"activity_ids,omitempty"` + ActivityState *Selection `xmlrpc:"activity_state,omitempty"` + ActivitySummary *String `xmlrpc:"activity_summary,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"` + CategId *Many2One `xmlrpc:"categ_id,omitempty"` + Color *Int `xmlrpc:"color,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CostMethod *String `xmlrpc:"cost_method,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"` + DescriptionPicking *String `xmlrpc:"description_picking,omitempty"` + DescriptionPickingin *String `xmlrpc:"description_pickingin,omitempty"` + DescriptionPickingout *String `xmlrpc:"description_pickingout,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"` + Id *Int `xmlrpc:"id,omitempty"` + Image *String `xmlrpc:"image,omitempty"` + ImageMedium *String `xmlrpc:"image_medium,omitempty"` + ImageSmall *String `xmlrpc:"image_small,omitempty"` + IncomingQty *Float `xmlrpc:"incoming_qty,omitempty"` + InvoicePolicy *Selection `xmlrpc:"invoice_policy,omitempty"` + IsProductVariant *Bool `xmlrpc:"is_product_variant,omitempty"` + ItemIds *Relation `xmlrpc:"item_ids,omitempty"` + ListPrice *Float `xmlrpc:"list_price,omitempty"` + LocationId *Many2One `xmlrpc:"location_id,omitempty"` + LstPrice *Float `xmlrpc:"lst_price,omitempty"` + MessageChannelIds *Relation `xmlrpc:"message_channel_ids,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageLastPost *Time `xmlrpc:"message_last_post,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MessageUnread *Bool `xmlrpc:"message_unread,omitempty"` + MessageUnreadCounter *Int `xmlrpc:"message_unread_counter,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + NbrReorderingRules *Int `xmlrpc:"nbr_reordering_rules,omitempty"` + OutgoingQty *Float `xmlrpc:"outgoing_qty,omitempty"` + PackagingIds *Relation `xmlrpc:"packaging_ids,omitempty"` + Price *Float `xmlrpc:"price,omitempty"` + PricelistId *Many2One `xmlrpc:"pricelist_id,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"` + PropertyAccountCreditorPriceDifference *Many2One `xmlrpc:"property_account_creditor_price_difference,omitempty"` + PropertyAccountExpenseId *Many2One `xmlrpc:"property_account_expense_id,omitempty"` + PropertyAccountIncomeId *Many2One `xmlrpc:"property_account_income_id,omitempty"` + PropertyCostMethod *Selection `xmlrpc:"property_cost_method,omitempty"` + PropertyStockAccountInput *Many2One `xmlrpc:"property_stock_account_input,omitempty"` + PropertyStockAccountOutput *Many2One `xmlrpc:"property_stock_account_output,omitempty"` + PropertyStockInventory *Many2One `xmlrpc:"property_stock_inventory,omitempty"` + PropertyStockProduction *Many2One `xmlrpc:"property_stock_production,omitempty"` + PropertyValuation *Selection `xmlrpc:"property_valuation,omitempty"` + PurchaseCount *Int `xmlrpc:"purchase_count,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"` + QtyAvailable *Float `xmlrpc:"qty_available,omitempty"` + Rental *Bool `xmlrpc:"rental,omitempty"` + ReorderingMaxQty *Float `xmlrpc:"reordering_max_qty,omitempty"` + ReorderingMinQty *Float `xmlrpc:"reordering_min_qty,omitempty"` + ResponsibleId *Many2One `xmlrpc:"responsible_id,omitempty"` + RouteFromCategIds *Relation `xmlrpc:"route_from_categ_ids,omitempty"` + RouteIds *Relation `xmlrpc:"route_ids,omitempty"` + SaleDelay *Float `xmlrpc:"sale_delay,omitempty"` + SaleLineWarn *Selection `xmlrpc:"sale_line_warn,omitempty"` + SaleLineWarnMsg *String `xmlrpc:"sale_line_warn_msg,omitempty"` + SaleOk *Bool `xmlrpc:"sale_ok,omitempty"` + SalesCount *Int `xmlrpc:"sales_count,omitempty"` + SellerIds *Relation `xmlrpc:"seller_ids,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + ServicePolicy *Selection `xmlrpc:"service_policy,omitempty"` + ServiceTracking *Selection `xmlrpc:"service_tracking,omitempty"` + ServiceType *Selection `xmlrpc:"service_type,omitempty"` + StandardPrice *Float `xmlrpc:"standard_price,omitempty"` + SupplierTaxesId *Relation `xmlrpc:"supplier_taxes_id,omitempty"` + TaxesId *Relation `xmlrpc:"taxes_id,omitempty"` + Tracking *Selection `xmlrpc:"tracking,omitempty"` + Type *Selection `xmlrpc:"type,omitempty"` + UomId *Many2One `xmlrpc:"uom_id,omitempty"` + UomPoId *Many2One `xmlrpc:"uom_po_id,omitempty"` + Valuation *String `xmlrpc:"valuation,omitempty"` + VariantSellerIds *Relation `xmlrpc:"variant_seller_ids,omitempty"` + VirtualAvailable *Float `xmlrpc:"virtual_available,omitempty"` + Volume *Float `xmlrpc:"volume,omitempty"` + WarehouseId *Many2One `xmlrpc:"warehouse_id,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + Weight *Float `xmlrpc:"weight,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) { + return c.Create(ProductTemplateModel, pt) +} + +// 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) +} + +// 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 + } + if pts != nil && len(*pts) > 0 { + return &((*pts)[0]), nil + } + return nil, fmt.Errorf("id %v of product.template not found", id) +} + +// 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 + } + if pts != nil && len(*pts) > 0 { + return &((*pts)[0]), nil + } + return nil, fmt.Errorf("no product.template was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(ProductTemplateModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no product.template was found with criteria %v and options %v", criteria, options) +} diff --git a/product_uom.go b/product_uom.go new file mode 100644 index 00000000..f99bf887 --- /dev/null +++ b/product_uom.go @@ -0,0 +1,125 @@ +package odoo + +import ( + "fmt" +) + +// ProductUom represents product.uom model. +type ProductUom struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + Active *Bool `xmlrpc:"active,omitempty"` + CategoryId *Many2One `xmlrpc:"category_id,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"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Rounding *Float `xmlrpc:"rounding,omitempty"` + UomType *Selection `xmlrpc:"uom_type,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ProductUoms represents array of product.uom model. +type ProductUoms []ProductUom + +// ProductUomModel is the odoo model name. +const ProductUomModel = "product.uom" + +// Many2One convert ProductUom to *Many2One. +func (pu *ProductUom) Many2One() *Many2One { + return NewMany2One(pu.Id.Get(), "") +} + +// CreateProductUom creates a new product.uom model and returns its id. +func (c *Client) CreateProductUom(pu *ProductUom) (int64, error) { + return c.Create(ProductUomModel, pu) +} + +// UpdateProductUom updates an existing product.uom record. +func (c *Client) UpdateProductUom(pu *ProductUom) error { + return c.UpdateProductUoms([]int64{pu.Id.Get()}, pu) +} + +// UpdateProductUoms updates existing product.uom records. +// All records (represented by ids) will be updated by pu values. +func (c *Client) UpdateProductUoms(ids []int64, pu *ProductUom) error { + return c.Update(ProductUomModel, ids, pu) +} + +// DeleteProductUom deletes an existing product.uom record. +func (c *Client) DeleteProductUom(id int64) error { + return c.DeleteProductUoms([]int64{id}) +} + +// DeleteProductUoms deletes existing product.uom records. +func (c *Client) DeleteProductUoms(ids []int64) error { + return c.Delete(ProductUomModel, ids) +} + +// GetProductUom gets product.uom existing record. +func (c *Client) GetProductUom(id int64) (*ProductUom, error) { + pus, err := c.GetProductUoms([]int64{id}) + if err != nil { + return nil, err + } + if pus != nil && len(*pus) > 0 { + return &((*pus)[0]), nil + } + return nil, fmt.Errorf("id %v of product.uom not found", id) +} + +// GetProductUoms gets product.uom existing records. +func (c *Client) GetProductUoms(ids []int64) (*ProductUoms, error) { + pus := &ProductUoms{} + if err := c.Read(ProductUomModel, ids, nil, pus); err != nil { + return nil, err + } + return pus, nil +} + +// FindProductUom finds product.uom record by querying it with criteria. +func (c *Client) FindProductUom(criteria *Criteria) (*ProductUom, error) { + pus := &ProductUoms{} + if err := c.SearchRead(ProductUomModel, criteria, NewOptions().Limit(1), pus); err != nil { + return nil, err + } + if pus != nil && len(*pus) > 0 { + return &((*pus)[0]), nil + } + return nil, fmt.Errorf("no product.uom was found with criteria %v", criteria) +} + +// FindProductUoms finds product.uom records by querying it +// and filtering it with criteria and options. +func (c *Client) FindProductUoms(criteria *Criteria, options *Options) (*ProductUoms, error) { + pus := &ProductUoms{} + if err := c.SearchRead(ProductUomModel, criteria, options, pus); err != nil { + return nil, err + } + return pus, nil +} + +// FindProductUomIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindProductUomIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(ProductUomModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindProductUomId finds record id by querying it with criteria. +func (c *Client) FindProductUomId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ProductUomModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no product.uom was found with criteria %v and options %v", criteria, options) +} diff --git a/product_uom_categ.go b/product_uom_categ.go new file mode 100644 index 00000000..18ce9164 --- /dev/null +++ b/product_uom_categ.go @@ -0,0 +1,119 @@ +package odoo + +import ( + "fmt" +) + +// ProductUomCateg represents product.uom.categ model. +type ProductUomCateg struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` +} + +// ProductUomCategs represents array of product.uom.categ model. +type ProductUomCategs []ProductUomCateg + +// ProductUomCategModel is the odoo model name. +const ProductUomCategModel = "product.uom.categ" + +// Many2One convert ProductUomCateg to *Many2One. +func (puc *ProductUomCateg) Many2One() *Many2One { + return NewMany2One(puc.Id.Get(), "") +} + +// CreateProductUomCateg creates a new product.uom.categ model and returns its id. +func (c *Client) CreateProductUomCateg(puc *ProductUomCateg) (int64, error) { + return c.Create(ProductUomCategModel, puc) +} + +// UpdateProductUomCateg updates an existing product.uom.categ record. +func (c *Client) UpdateProductUomCateg(puc *ProductUomCateg) error { + return c.UpdateProductUomCategs([]int64{puc.Id.Get()}, puc) +} + +// UpdateProductUomCategs updates existing product.uom.categ records. +// All records (represented by ids) will be updated by puc values. +func (c *Client) UpdateProductUomCategs(ids []int64, puc *ProductUomCateg) error { + return c.Update(ProductUomCategModel, ids, puc) +} + +// DeleteProductUomCateg deletes an existing product.uom.categ record. +func (c *Client) DeleteProductUomCateg(id int64) error { + return c.DeleteProductUomCategs([]int64{id}) +} + +// DeleteProductUomCategs deletes existing product.uom.categ records. +func (c *Client) DeleteProductUomCategs(ids []int64) error { + return c.Delete(ProductUomCategModel, ids) +} + +// GetProductUomCateg gets product.uom.categ existing record. +func (c *Client) GetProductUomCateg(id int64) (*ProductUomCateg, error) { + pucs, err := c.GetProductUomCategs([]int64{id}) + if err != nil { + return nil, err + } + if pucs != nil && len(*pucs) > 0 { + return &((*pucs)[0]), nil + } + return nil, fmt.Errorf("id %v of product.uom.categ not found", id) +} + +// GetProductUomCategs gets product.uom.categ existing records. +func (c *Client) GetProductUomCategs(ids []int64) (*ProductUomCategs, error) { + pucs := &ProductUomCategs{} + if err := c.Read(ProductUomCategModel, ids, nil, pucs); err != nil { + return nil, err + } + return pucs, nil +} + +// FindProductUomCateg finds product.uom.categ record by querying it with criteria. +func (c *Client) FindProductUomCateg(criteria *Criteria) (*ProductUomCateg, error) { + pucs := &ProductUomCategs{} + if err := c.SearchRead(ProductUomCategModel, criteria, NewOptions().Limit(1), pucs); err != nil { + return nil, err + } + if pucs != nil && len(*pucs) > 0 { + return &((*pucs)[0]), nil + } + return nil, fmt.Errorf("no product.uom.categ was found with criteria %v", criteria) +} + +// FindProductUomCategs finds product.uom.categ records by querying it +// and filtering it with criteria and options. +func (c *Client) FindProductUomCategs(criteria *Criteria, options *Options) (*ProductUomCategs, error) { + pucs := &ProductUomCategs{} + if err := c.SearchRead(ProductUomCategModel, criteria, options, pucs); err != nil { + return nil, err + } + return pucs, nil +} + +// FindProductUomCategIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindProductUomCategIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(ProductUomCategModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindProductUomCategId finds record id by querying it with criteria. +func (c *Client) FindProductUomCategId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ProductUomCategModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no product.uom.categ was found with criteria %v and options %v", criteria, options) +} diff --git a/project_project.go b/project_project.go index e5679ff1..8f24a09f 100644 --- a/project_project.go +++ b/project_project.go @@ -6,71 +6,71 @@ import ( // ProjectProject represents project.project model. type ProjectProject struct { - LastUpdate *Time `xmlrpc:"__last_update,omptempty"` - Active *Bool `xmlrpc:"active,omptempty"` - AliasContact *Selection `xmlrpc:"alias_contact,omptempty"` - AliasDefaults *String `xmlrpc:"alias_defaults,omptempty"` - AliasDomain *String `xmlrpc:"alias_domain,omptempty"` - AliasForceThreadId *Int `xmlrpc:"alias_force_thread_id,omptempty"` - AliasId *Many2One `xmlrpc:"alias_id,omptempty"` - AliasModelId *Many2One `xmlrpc:"alias_model_id,omptempty"` - AliasName *String `xmlrpc:"alias_name,omptempty"` - AliasParentModelId *Many2One `xmlrpc:"alias_parent_model_id,omptempty"` - AliasParentThreadId *Int `xmlrpc:"alias_parent_thread_id,omptempty"` - AliasUserId *Many2One `xmlrpc:"alias_user_id,omptempty"` - AllowTimesheets *Bool `xmlrpc:"allow_timesheets,omptempty"` - AnalyticAccountId *Many2One `xmlrpc:"analytic_account_id,omptempty"` - Balance *Float `xmlrpc:"balance,omptempty"` - Code *String `xmlrpc:"code,omptempty"` - Color *Int `xmlrpc:"color,omptempty"` - CompanyId *Many2One `xmlrpc:"company_id,omptempty"` - CompanyUomId *Many2One `xmlrpc:"company_uom_id,omptempty"` - CreateDate *Time `xmlrpc:"create_date,omptempty"` - CreateUid *Many2One `xmlrpc:"create_uid,omptempty"` - Credit *Float `xmlrpc:"credit,omptempty"` - CurrencyId *Many2One `xmlrpc:"currency_id,omptempty"` - Date *Time `xmlrpc:"date,omptempty"` - DateStart *Time `xmlrpc:"date_start,omptempty"` - Debit *Float `xmlrpc:"debit,omptempty"` - DisplayName *String `xmlrpc:"display_name,omptempty"` - DocCount *Int `xmlrpc:"doc_count,omptempty"` - FavoriteUserIds *Relation `xmlrpc:"favorite_user_ids,omptempty"` - Id *Int `xmlrpc:"id,omptempty"` - IsFavorite *Bool `xmlrpc:"is_favorite,omptempty"` - LabelTasks *String `xmlrpc:"label_tasks,omptempty"` - LineIds *Relation `xmlrpc:"line_ids,omptempty"` - MachineProjectName *String `xmlrpc:"machine_project_name,omptempty"` - MessageChannelIds *Relation `xmlrpc:"message_channel_ids,omptempty"` - MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omptempty"` - MessageIds *Relation `xmlrpc:"message_ids,omptempty"` - MessageIsFollower *Bool `xmlrpc:"message_is_follower,omptempty"` - MessageLastPost *Time `xmlrpc:"message_last_post,omptempty"` - MessageNeedaction *Bool `xmlrpc:"message_needaction,omptempty"` - MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omptempty"` - MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omptempty"` - MessageUnread *Bool `xmlrpc:"message_unread,omptempty"` - MessageUnreadCounter *Int `xmlrpc:"message_unread_counter,omptempty"` - Name *String `xmlrpc:"name,omptempty"` - PartnerId *Many2One `xmlrpc:"partner_id,omptempty"` - PortalUrl *String `xmlrpc:"portal_url,omptempty"` - PrivacyVisibility *Selection `xmlrpc:"privacy_visibility,omptempty"` - ProjectCount *Int `xmlrpc:"project_count,omptempty"` - ProjectCreated *Bool `xmlrpc:"project_created,omptempty"` - ProjectIds *Relation `xmlrpc:"project_ids,omptempty"` - ResourceCalendarId *Many2One `xmlrpc:"resource_calendar_id,omptempty"` - SaleLineId *Many2One `xmlrpc:"sale_line_id,omptempty"` - Sequence *Int `xmlrpc:"sequence,omptempty"` - SubtaskProjectId *Many2One `xmlrpc:"subtask_project_id,omptempty"` - TagIds *Relation `xmlrpc:"tag_ids,omptempty"` - TaskCount *Int `xmlrpc:"task_count,omptempty"` - TaskIds *Relation `xmlrpc:"task_ids,omptempty"` - TaskNeedactionCount *Int `xmlrpc:"task_needaction_count,omptempty"` - Tasks *Relation `xmlrpc:"tasks,omptempty"` - TypeIds *Relation `xmlrpc:"type_ids,omptempty"` - UserId *Many2One `xmlrpc:"user_id,omptempty"` - WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omptempty"` - WriteDate *Time `xmlrpc:"write_date,omptempty"` - WriteUid *Many2One `xmlrpc:"write_uid,omptempty"` + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + Active *Bool `xmlrpc:"active,omitempty"` + AliasContact *Selection `xmlrpc:"alias_contact,omitempty"` + AliasDefaults *String `xmlrpc:"alias_defaults,omitempty"` + AliasDomain *String `xmlrpc:"alias_domain,omitempty"` + AliasForceThreadId *Int `xmlrpc:"alias_force_thread_id,omitempty"` + AliasId *Many2One `xmlrpc:"alias_id,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"` + AliasUserId *Many2One `xmlrpc:"alias_user_id,omitempty"` + AllowTimesheets *Bool `xmlrpc:"allow_timesheets,omitempty"` + AnalyticAccountId *Many2One `xmlrpc:"analytic_account_id,omitempty"` + Balance *Float `xmlrpc:"balance,omitempty"` + Code *String `xmlrpc:"code,omitempty"` + Color *Int `xmlrpc:"color,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CompanyUomId *Many2One `xmlrpc:"company_uom_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"` + Date *Time `xmlrpc:"date,omitempty"` + DateStart *Time `xmlrpc:"date_start,omitempty"` + Debit *Float `xmlrpc:"debit,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + DocCount *Int `xmlrpc:"doc_count,omitempty"` + FavoriteUserIds *Relation `xmlrpc:"favorite_user_ids,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsFavorite *Bool `xmlrpc:"is_favorite,omitempty"` + LabelTasks *String `xmlrpc:"label_tasks,omitempty"` + LineIds *Relation `xmlrpc:"line_ids,omitempty"` + MachineProjectName *String `xmlrpc:"machine_project_name,omitempty"` + MessageChannelIds *Relation `xmlrpc:"message_channel_ids,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageLastPost *Time `xmlrpc:"message_last_post,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MessageUnread *Bool `xmlrpc:"message_unread,omitempty"` + MessageUnreadCounter *Int `xmlrpc:"message_unread_counter,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PortalUrl *String `xmlrpc:"portal_url,omitempty"` + PrivacyVisibility *Selection `xmlrpc:"privacy_visibility,omitempty"` + ProjectCount *Int `xmlrpc:"project_count,omitempty"` + ProjectCreated *Bool `xmlrpc:"project_created,omitempty"` + ProjectIds *Relation `xmlrpc:"project_ids,omitempty"` + ResourceCalendarId *Many2One `xmlrpc:"resource_calendar_id,omitempty"` + SaleLineId *Many2One `xmlrpc:"sale_line_id,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + SubtaskProjectId *Many2One `xmlrpc:"subtask_project_id,omitempty"` + TagIds *Relation `xmlrpc:"tag_ids,omitempty"` + TaskCount *Int `xmlrpc:"task_count,omitempty"` + TaskIds *Relation `xmlrpc:"task_ids,omitempty"` + TaskNeedactionCount *Int `xmlrpc:"task_needaction_count,omitempty"` + Tasks *Relation `xmlrpc:"tasks,omitempty"` + TypeIds *Relation `xmlrpc:"type_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"` } // ProjectProjects represents array of project.project model. @@ -140,7 +140,7 @@ func (c *Client) FindProjectProject(criteria *Criteria) (*ProjectProject, error) if pps != nil && len(*pps) > 0 { return &((*pps)[0]), nil } - return nil, fmt.Errorf("project.project was not found") + return nil, fmt.Errorf("no project.project was found with criteria %v", criteria) } // FindProjectProjects finds project.project records by querying it @@ -172,5 +172,5 @@ func (c *Client) FindProjectProjectId(criteria *Criteria, options *Options) (int if len(ids) > 0 { return ids[0], nil } - return -1, fmt.Errorf("project.project was not found") + return -1, fmt.Errorf("no project.project was found with criteria %v and options %v", criteria, options) } diff --git a/project_tags.go b/project_tags.go new file mode 100644 index 00000000..1a116b7f --- /dev/null +++ b/project_tags.go @@ -0,0 +1,120 @@ +package odoo + +import ( + "fmt" +) + +// ProjectTags represents project.tags model. +type ProjectTags struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` + 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) { + return c.Create(ProjectTagsModel, pt) +} + +// 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) +} + +// 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 + } + if pts != nil && len(*pts) > 0 { + return &((*pts)[0]), nil + } + return nil, fmt.Errorf("id %v of project.tags not found", id) +} + +// 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 + } + if pts != nil && len(*pts) > 0 { + return &((*pts)[0]), nil + } + return nil, fmt.Errorf("no project.tags was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(ProjectTagsModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no project.tags was found with criteria %v and options %v", criteria, options) +} diff --git a/project_task.go b/project_task.go index af9219f6..8d63ed68 100644 --- a/project_task.go +++ b/project_task.go @@ -6,78 +6,78 @@ import ( // ProjectTask represents project.task model. type ProjectTask struct { - LastUpdate *Time `xmlrpc:"__last_update,omptempty"` - Active *Bool `xmlrpc:"active,omptempty"` - ActivityDateDeadline *Time `xmlrpc:"activity_date_deadline,omptempty"` - ActivityIds *Relation `xmlrpc:"activity_ids,omptempty"` - ActivityState *Selection `xmlrpc:"activity_state,omptempty"` - ActivitySummary *String `xmlrpc:"activity_summary,omptempty"` - ActivityTypeId *Many2One `xmlrpc:"activity_type_id,omptempty"` - ActivityUserId *Many2One `xmlrpc:"activity_user_id,omptempty"` - AttachmentIds *Relation `xmlrpc:"attachment_ids,omptempty"` - ChildIds *Relation `xmlrpc:"child_ids,omptempty"` - ChildrenHours *Float `xmlrpc:"children_hours,omptempty"` - Color *Int `xmlrpc:"color,omptempty"` - CompanyId *Many2One `xmlrpc:"company_id,omptempty"` - CreateDate *Time `xmlrpc:"create_date,omptempty"` - CreateUid *Many2One `xmlrpc:"create_uid,omptempty"` - DateAssign *Time `xmlrpc:"date_assign,omptempty"` - DateDeadline *Time `xmlrpc:"date_deadline,omptempty"` - DateEnd *Time `xmlrpc:"date_end,omptempty"` - DateLastStageUpdate *Time `xmlrpc:"date_last_stage_update,omptempty"` - DateStart *Time `xmlrpc:"date_start,omptempty"` - DelayHours *Float `xmlrpc:"delay_hours,omptempty"` - Description *String `xmlrpc:"description,omptempty"` - DisplayName *String `xmlrpc:"display_name,omptempty"` - DisplayedImageId *Many2One `xmlrpc:"displayed_image_id,omptempty"` - EffectiveHours *Float `xmlrpc:"effective_hours,omptempty"` - EmailCc *String `xmlrpc:"email_cc,omptempty"` - EmailFrom *String `xmlrpc:"email_from,omptempty"` - Id *Int `xmlrpc:"id,omptempty"` - KanbanState *Selection `xmlrpc:"kanban_state,omptempty"` - KanbanStateLabel *String `xmlrpc:"kanban_state_label,omptempty"` - LegendBlocked *String `xmlrpc:"legend_blocked,omptempty"` - LegendDone *String `xmlrpc:"legend_done,omptempty"` - LegendNormal *String `xmlrpc:"legend_normal,omptempty"` - ManagerId *Many2One `xmlrpc:"manager_id,omptempty"` - MessageChannelIds *Relation `xmlrpc:"message_channel_ids,omptempty"` - MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omptempty"` - MessageIds *Relation `xmlrpc:"message_ids,omptempty"` - MessageIsFollower *Bool `xmlrpc:"message_is_follower,omptempty"` - MessageLastPost *Time `xmlrpc:"message_last_post,omptempty"` - MessageNeedaction *Bool `xmlrpc:"message_needaction,omptempty"` - MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omptempty"` - MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omptempty"` - MessageUnread *Bool `xmlrpc:"message_unread,omptempty"` - MessageUnreadCounter *Int `xmlrpc:"message_unread_counter,omptempty"` - Name *String `xmlrpc:"name,omptempty"` - Notes *String `xmlrpc:"notes,omptempty"` - ParentId *Many2One `xmlrpc:"parent_id,omptempty"` - PartnerId *Many2One `xmlrpc:"partner_id,omptempty"` - PlannedHours *Float `xmlrpc:"planned_hours,omptempty"` - PortalUrl *String `xmlrpc:"portal_url,omptempty"` - Priority *Selection `xmlrpc:"priority,omptempty"` - Progress *Float `xmlrpc:"progress,omptempty"` - ProjectId *Many2One `xmlrpc:"project_id,omptempty"` - RemainingHours *Float `xmlrpc:"remaining_hours,omptempty"` - SaleLineId *Many2One `xmlrpc:"sale_line_id,omptempty"` - Sequence *Int `xmlrpc:"sequence,omptempty"` - StageId *Many2One `xmlrpc:"stage_id,omptempty"` - SubtaskCount *Int `xmlrpc:"subtask_count,omptempty"` - SubtaskProjectId *Many2One `xmlrpc:"subtask_project_id,omptempty"` - TagIds *Relation `xmlrpc:"tag_ids,omptempty"` - TimesheetIds *Relation `xmlrpc:"timesheet_ids,omptempty"` - TotalHours *Float `xmlrpc:"total_hours,omptempty"` - TotalHoursSpent *Float `xmlrpc:"total_hours_spent,omptempty"` - UserEmail *String `xmlrpc:"user_email,omptempty"` - UserId *Many2One `xmlrpc:"user_id,omptempty"` - WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omptempty"` - WorkingDaysClose *Float `xmlrpc:"working_days_close,omptempty"` - WorkingDaysOpen *Float `xmlrpc:"working_days_open,omptempty"` - WorkingHoursClose *Float `xmlrpc:"working_hours_close,omptempty"` - WorkingHoursOpen *Float `xmlrpc:"working_hours_open,omptempty"` - WriteDate *Time `xmlrpc:"write_date,omptempty"` - WriteUid *Many2One `xmlrpc:"write_uid,omptempty"` + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + Active *Bool `xmlrpc:"active,omitempty"` + ActivityDateDeadline *Time `xmlrpc:"activity_date_deadline,omitempty"` + ActivityIds *Relation `xmlrpc:"activity_ids,omitempty"` + ActivityState *Selection `xmlrpc:"activity_state,omitempty"` + ActivitySummary *String `xmlrpc:"activity_summary,omitempty"` + ActivityTypeId *Many2One `xmlrpc:"activity_type_id,omitempty"` + ActivityUserId *Many2One `xmlrpc:"activity_user_id,omitempty"` + AttachmentIds *Relation `xmlrpc:"attachment_ids,omitempty"` + ChildIds *Relation `xmlrpc:"child_ids,omitempty"` + ChildrenHours *Float `xmlrpc:"children_hours,omitempty"` + Color *Int `xmlrpc:"color,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,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"` + DateStart *Time `xmlrpc:"date_start,omitempty"` + DelayHours *Float `xmlrpc:"delay_hours,omitempty"` + Description *String `xmlrpc:"description,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + DisplayedImageId *Many2One `xmlrpc:"displayed_image_id,omitempty"` + EffectiveHours *Float `xmlrpc:"effective_hours,omitempty"` + EmailCc *String `xmlrpc:"email_cc,omitempty"` + EmailFrom *String `xmlrpc:"email_from,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + KanbanState *Selection `xmlrpc:"kanban_state,omitempty"` + KanbanStateLabel *String `xmlrpc:"kanban_state_label,omitempty"` + LegendBlocked *String `xmlrpc:"legend_blocked,omitempty"` + LegendDone *String `xmlrpc:"legend_done,omitempty"` + LegendNormal *String `xmlrpc:"legend_normal,omitempty"` + ManagerId *Many2One `xmlrpc:"manager_id,omitempty"` + MessageChannelIds *Relation `xmlrpc:"message_channel_ids,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageLastPost *Time `xmlrpc:"message_last_post,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MessageUnread *Bool `xmlrpc:"message_unread,omitempty"` + MessageUnreadCounter *Int `xmlrpc:"message_unread_counter,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Notes *String `xmlrpc:"notes,omitempty"` + ParentId *Many2One `xmlrpc:"parent_id,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PlannedHours *Float `xmlrpc:"planned_hours,omitempty"` + PortalUrl *String `xmlrpc:"portal_url,omitempty"` + Priority *Selection `xmlrpc:"priority,omitempty"` + Progress *Float `xmlrpc:"progress,omitempty"` + ProjectId *Many2One `xmlrpc:"project_id,omitempty"` + RemainingHours *Float `xmlrpc:"remaining_hours,omitempty"` + SaleLineId *Many2One `xmlrpc:"sale_line_id,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + StageId *Many2One `xmlrpc:"stage_id,omitempty"` + SubtaskCount *Int `xmlrpc:"subtask_count,omitempty"` + SubtaskProjectId *Many2One `xmlrpc:"subtask_project_id,omitempty"` + TagIds *Relation `xmlrpc:"tag_ids,omitempty"` + TimesheetIds *Relation `xmlrpc:"timesheet_ids,omitempty"` + TotalHours *Float `xmlrpc:"total_hours,omitempty"` + TotalHoursSpent *Float `xmlrpc:"total_hours_spent,omitempty"` + UserEmail *String `xmlrpc:"user_email,omitempty"` + UserId *Many2One `xmlrpc:"user_id,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. @@ -147,7 +147,7 @@ func (c *Client) FindProjectTask(criteria *Criteria) (*ProjectTask, error) { if pts != nil && len(*pts) > 0 { return &((*pts)[0]), nil } - return nil, fmt.Errorf("project.task was not found") + return nil, fmt.Errorf("no project.task was found with criteria %v", criteria) } // FindProjectTasks finds project.task records by querying it @@ -179,5 +179,5 @@ func (c *Client) FindProjectTaskId(criteria *Criteria, options *Options) (int64, if len(ids) > 0 { return ids[0], nil } - return -1, fmt.Errorf("project.task was not found") + return -1, fmt.Errorf("no project.task was found with criteria %v and options %v", criteria, options) } diff --git a/project_task_merge_wizard.go b/project_task_merge_wizard.go new file mode 100644 index 00000000..90242cc5 --- /dev/null +++ b/project_task_merge_wizard.go @@ -0,0 +1,124 @@ +package odoo + +import ( + "fmt" +) + +// ProjectTaskMergeWizard represents project.task.merge.wizard model. +type ProjectTaskMergeWizard struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateNewTask *Bool `xmlrpc:"create_new_task,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + TargetProjectId *Many2One `xmlrpc:"target_project_id,omitempty"` + TargetTaskId *Many2One `xmlrpc:"target_task_id,omitempty"` + TargetTaskName *String `xmlrpc:"target_task_name,omitempty"` + TaskIds *Relation `xmlrpc:"task_ids,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ProjectTaskMergeWizards represents array of project.task.merge.wizard model. +type ProjectTaskMergeWizards []ProjectTaskMergeWizard + +// ProjectTaskMergeWizardModel is the odoo model name. +const ProjectTaskMergeWizardModel = "project.task.merge.wizard" + +// Many2One convert ProjectTaskMergeWizard to *Many2One. +func (ptmw *ProjectTaskMergeWizard) Many2One() *Many2One { + return NewMany2One(ptmw.Id.Get(), "") +} + +// CreateProjectTaskMergeWizard creates a new project.task.merge.wizard model and returns its id. +func (c *Client) CreateProjectTaskMergeWizard(ptmw *ProjectTaskMergeWizard) (int64, error) { + return c.Create(ProjectTaskMergeWizardModel, ptmw) +} + +// UpdateProjectTaskMergeWizard updates an existing project.task.merge.wizard record. +func (c *Client) UpdateProjectTaskMergeWizard(ptmw *ProjectTaskMergeWizard) error { + return c.UpdateProjectTaskMergeWizards([]int64{ptmw.Id.Get()}, ptmw) +} + +// UpdateProjectTaskMergeWizards updates existing project.task.merge.wizard records. +// All records (represented by ids) will be updated by ptmw values. +func (c *Client) UpdateProjectTaskMergeWizards(ids []int64, ptmw *ProjectTaskMergeWizard) error { + return c.Update(ProjectTaskMergeWizardModel, ids, ptmw) +} + +// DeleteProjectTaskMergeWizard deletes an existing project.task.merge.wizard record. +func (c *Client) DeleteProjectTaskMergeWizard(id int64) error { + return c.DeleteProjectTaskMergeWizards([]int64{id}) +} + +// DeleteProjectTaskMergeWizards deletes existing project.task.merge.wizard records. +func (c *Client) DeleteProjectTaskMergeWizards(ids []int64) error { + return c.Delete(ProjectTaskMergeWizardModel, ids) +} + +// GetProjectTaskMergeWizard gets project.task.merge.wizard existing record. +func (c *Client) GetProjectTaskMergeWizard(id int64) (*ProjectTaskMergeWizard, error) { + ptmws, err := c.GetProjectTaskMergeWizards([]int64{id}) + if err != nil { + return nil, err + } + if ptmws != nil && len(*ptmws) > 0 { + return &((*ptmws)[0]), nil + } + return nil, fmt.Errorf("id %v of project.task.merge.wizard not found", id) +} + +// GetProjectTaskMergeWizards gets project.task.merge.wizard existing records. +func (c *Client) GetProjectTaskMergeWizards(ids []int64) (*ProjectTaskMergeWizards, error) { + ptmws := &ProjectTaskMergeWizards{} + if err := c.Read(ProjectTaskMergeWizardModel, ids, nil, ptmws); err != nil { + return nil, err + } + return ptmws, nil +} + +// FindProjectTaskMergeWizard finds project.task.merge.wizard record by querying it with criteria. +func (c *Client) FindProjectTaskMergeWizard(criteria *Criteria) (*ProjectTaskMergeWizard, error) { + ptmws := &ProjectTaskMergeWizards{} + if err := c.SearchRead(ProjectTaskMergeWizardModel, criteria, NewOptions().Limit(1), ptmws); err != nil { + return nil, err + } + if ptmws != nil && len(*ptmws) > 0 { + return &((*ptmws)[0]), nil + } + return nil, fmt.Errorf("no project.task.merge.wizard was found with criteria %v", criteria) +} + +// FindProjectTaskMergeWizards finds project.task.merge.wizard records by querying it +// and filtering it with criteria and options. +func (c *Client) FindProjectTaskMergeWizards(criteria *Criteria, options *Options) (*ProjectTaskMergeWizards, error) { + ptmws := &ProjectTaskMergeWizards{} + if err := c.SearchRead(ProjectTaskMergeWizardModel, criteria, options, ptmws); err != nil { + return nil, err + } + return ptmws, nil +} + +// FindProjectTaskMergeWizardIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindProjectTaskMergeWizardIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(ProjectTaskMergeWizardModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindProjectTaskMergeWizardId finds record id by querying it with criteria. +func (c *Client) FindProjectTaskMergeWizardId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ProjectTaskMergeWizardModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no project.task.merge.wizard was found with criteria %v and options %v", criteria, options) +} diff --git a/project_task_type.go b/project_task_type.go new file mode 100644 index 00000000..cc161adc --- /dev/null +++ b/project_task_type.go @@ -0,0 +1,128 @@ +package odoo + +import ( + "fmt" +) + +// ProjectTaskType represents project.task.type model. +type ProjectTaskType struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Description *String `xmlrpc:"description,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Fold *Bool `xmlrpc:"fold,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LegendBlocked *String `xmlrpc:"legend_blocked,omitempty"` + LegendDone *String `xmlrpc:"legend_done,omitempty"` + LegendNormal *String `xmlrpc:"legend_normal,omitempty"` + LegendPriority *String `xmlrpc:"legend_priority,omitempty"` + MailTemplateId *Many2One `xmlrpc:"mail_template_id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + ProjectIds *Relation `xmlrpc:"project_ids,omitempty"` + Sequence *Int `xmlrpc:"sequence,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) { + return c.Create(ProjectTaskTypeModel, ptt) +} + +// 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) +} + +// 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 + } + if ptts != nil && len(*ptts) > 0 { + return &((*ptts)[0]), nil + } + return nil, fmt.Errorf("id %v of project.task.type not found", id) +} + +// 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 + } + if ptts != nil && len(*ptts) > 0 { + return &((*ptts)[0]), nil + } + return nil, fmt.Errorf("no project.task.type was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(ProjectTaskTypeModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no project.task.type was found with criteria %v and options %v", criteria, options) +} diff --git a/publisher_warranty_contract.go b/publisher_warranty_contract.go new file mode 100644 index 00000000..676685a9 --- /dev/null +++ b/publisher_warranty_contract.go @@ -0,0 +1,114 @@ +package odoo + +import ( + "fmt" +) + +// PublisherWarrantyContract represents publisher_warranty.contract model. +type PublisherWarrantyContract struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` +} + +// PublisherWarrantyContracts represents array of publisher_warranty.contract model. +type PublisherWarrantyContracts []PublisherWarrantyContract + +// PublisherWarrantyContractModel is the odoo model name. +const PublisherWarrantyContractModel = "publisher_warranty.contract" + +// Many2One convert PublisherWarrantyContract to *Many2One. +func (pc *PublisherWarrantyContract) Many2One() *Many2One { + return NewMany2One(pc.Id.Get(), "") +} + +// CreatePublisherWarrantyContract creates a new publisher_warranty.contract model and returns its id. +func (c *Client) CreatePublisherWarrantyContract(pc *PublisherWarrantyContract) (int64, error) { + return c.Create(PublisherWarrantyContractModel, pc) +} + +// UpdatePublisherWarrantyContract updates an existing publisher_warranty.contract record. +func (c *Client) UpdatePublisherWarrantyContract(pc *PublisherWarrantyContract) error { + return c.UpdatePublisherWarrantyContracts([]int64{pc.Id.Get()}, pc) +} + +// UpdatePublisherWarrantyContracts updates existing publisher_warranty.contract records. +// All records (represented by ids) will be updated by pc values. +func (c *Client) UpdatePublisherWarrantyContracts(ids []int64, pc *PublisherWarrantyContract) error { + return c.Update(PublisherWarrantyContractModel, ids, pc) +} + +// DeletePublisherWarrantyContract deletes an existing publisher_warranty.contract record. +func (c *Client) DeletePublisherWarrantyContract(id int64) error { + return c.DeletePublisherWarrantyContracts([]int64{id}) +} + +// DeletePublisherWarrantyContracts deletes existing publisher_warranty.contract records. +func (c *Client) DeletePublisherWarrantyContracts(ids []int64) error { + return c.Delete(PublisherWarrantyContractModel, ids) +} + +// GetPublisherWarrantyContract gets publisher_warranty.contract existing record. +func (c *Client) GetPublisherWarrantyContract(id int64) (*PublisherWarrantyContract, error) { + pcs, err := c.GetPublisherWarrantyContracts([]int64{id}) + if err != nil { + return nil, err + } + if pcs != nil && len(*pcs) > 0 { + return &((*pcs)[0]), nil + } + return nil, fmt.Errorf("id %v of publisher_warranty.contract not found", id) +} + +// GetPublisherWarrantyContracts gets publisher_warranty.contract existing records. +func (c *Client) GetPublisherWarrantyContracts(ids []int64) (*PublisherWarrantyContracts, error) { + pcs := &PublisherWarrantyContracts{} + if err := c.Read(PublisherWarrantyContractModel, ids, nil, pcs); err != nil { + return nil, err + } + return pcs, nil +} + +// FindPublisherWarrantyContract finds publisher_warranty.contract record by querying it with criteria. +func (c *Client) FindPublisherWarrantyContract(criteria *Criteria) (*PublisherWarrantyContract, error) { + pcs := &PublisherWarrantyContracts{} + if err := c.SearchRead(PublisherWarrantyContractModel, criteria, NewOptions().Limit(1), pcs); err != nil { + return nil, err + } + if pcs != nil && len(*pcs) > 0 { + return &((*pcs)[0]), nil + } + return nil, fmt.Errorf("no publisher_warranty.contract was found with criteria %v", criteria) +} + +// FindPublisherWarrantyContracts finds publisher_warranty.contract records by querying it +// and filtering it with criteria and options. +func (c *Client) FindPublisherWarrantyContracts(criteria *Criteria, options *Options) (*PublisherWarrantyContracts, error) { + pcs := &PublisherWarrantyContracts{} + if err := c.SearchRead(PublisherWarrantyContractModel, criteria, options, pcs); err != nil { + return nil, err + } + return pcs, nil +} + +// FindPublisherWarrantyContractIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindPublisherWarrantyContractIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(PublisherWarrantyContractModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindPublisherWarrantyContractId finds record id by querying it with criteria. +func (c *Client) FindPublisherWarrantyContractId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(PublisherWarrantyContractModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no publisher_warranty.contract was found with criteria %v and options %v", criteria, options) +} diff --git a/purchase_order.go b/purchase_order.go new file mode 100644 index 00000000..a50e2d19 --- /dev/null +++ b/purchase_order.go @@ -0,0 +1,165 @@ +package odoo + +import ( + "fmt" +) + +// PurchaseOrder represents purchase.order model. +type PurchaseOrder struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + ActivityDateDeadline *Time `xmlrpc:"activity_date_deadline,omitempty"` + ActivityIds *Relation `xmlrpc:"activity_ids,omitempty"` + ActivityState *Selection `xmlrpc:"activity_state,omitempty"` + ActivitySummary *String `xmlrpc:"activity_summary,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"` + AmountUntaxed *Float `xmlrpc:"amount_untaxed,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"` + DefaultLocationDestIdUsage *Selection `xmlrpc:"default_location_dest_id_usage,omitempty"` + DestAddressId *Many2One `xmlrpc:"dest_address_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + FiscalPositionId *Many2One `xmlrpc:"fiscal_position_id,omitempty"` + GroupId *Many2One `xmlrpc:"group_id,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"` + IsShipped *Bool `xmlrpc:"is_shipped,omitempty"` + MessageChannelIds *Relation `xmlrpc:"message_channel_ids,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageLastPost *Time `xmlrpc:"message_last_post,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MessageUnread *Bool `xmlrpc:"message_unread,omitempty"` + MessageUnreadCounter *Int `xmlrpc:"message_unread_counter,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Notes *String `xmlrpc:"notes,omitempty"` + OrderLine *Relation `xmlrpc:"order_line,omitempty"` + Origin *String `xmlrpc:"origin,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PartnerRef *String `xmlrpc:"partner_ref,omitempty"` + PaymentTermId *Many2One `xmlrpc:"payment_term_id,omitempty"` + PickingCount *Int `xmlrpc:"picking_count,omitempty"` + PickingIds *Relation `xmlrpc:"picking_ids,omitempty"` + PickingTypeId *Many2One `xmlrpc:"picking_type_id,omitempty"` + ProductId *Many2One `xmlrpc:"product_id,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + WebsiteUrl *String `xmlrpc:"website_url,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) { + return c.Create(PurchaseOrderModel, po) +} + +// 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) +} + +// 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 + } + if pos != nil && len(*pos) > 0 { + return &((*pos)[0]), nil + } + return nil, fmt.Errorf("id %v of purchase.order not found", id) +} + +// 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 + } + if pos != nil && len(*pos) > 0 { + return &((*pos)[0]), nil + } + return nil, fmt.Errorf("no purchase.order was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(PurchaseOrderModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no purchase.order was found with criteria %v and options %v", criteria, options) +} diff --git a/purchase_order_line.go b/purchase_order_line.go new file mode 100644 index 00000000..1a5a7f76 --- /dev/null +++ b/purchase_order_line.go @@ -0,0 +1,144 @@ +package odoo + +import ( + "fmt" +) + +// PurchaseOrderLine represents purchase.order.line model. +type PurchaseOrderLine struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AccountAnalyticId *Many2One `xmlrpc:"account_analytic_id,omitempty"` + AnalyticTagIds *Relation `xmlrpc:"analytic_tag_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"` + DateOrder *Time `xmlrpc:"date_order,omitempty"` + DatePlanned *Time `xmlrpc:"date_planned,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + InvoiceLines *Relation `xmlrpc:"invoice_lines,omitempty"` + MoveDestIds *Relation `xmlrpc:"move_dest_ids,omitempty"` + MoveIds *Relation `xmlrpc:"move_ids,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + OrderId *Many2One `xmlrpc:"order_id,omitempty"` + OrderpointId *Many2One `xmlrpc:"orderpoint_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"` + ProductId *Many2One `xmlrpc:"product_id,omitempty"` + ProductImage *String `xmlrpc:"product_image,omitempty"` + ProductQty *Float `xmlrpc:"product_qty,omitempty"` + ProductUom *Many2One `xmlrpc:"product_uom,omitempty"` + QtyInvoiced *Float `xmlrpc:"qty_invoiced,omitempty"` + QtyReceived *Float `xmlrpc:"qty_received,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + State *Selection `xmlrpc:"state,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) { + return c.Create(PurchaseOrderLineModel, pol) +} + +// 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) +} + +// 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 + } + if pols != nil && len(*pols) > 0 { + return &((*pols)[0]), nil + } + return nil, fmt.Errorf("id %v of purchase.order.line not found", id) +} + +// 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 + } + if pols != nil && len(*pols) > 0 { + return &((*pols)[0]), nil + } + return nil, fmt.Errorf("no purchase.order.line was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(PurchaseOrderLineModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no purchase.order.line was found with criteria %v and options %v", criteria, options) +} diff --git a/purchase_report.go b/purchase_report.go new file mode 100644 index 00000000..47bddf0a --- /dev/null +++ b/purchase_report.go @@ -0,0 +1,140 @@ +package odoo + +import ( + "fmt" +) + +// PurchaseReport represents purchase.report model. +type PurchaseReport struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AccountAnalyticId *Many2One `xmlrpc:"account_analytic_id,omitempty"` + 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"` + Negociation *Float `xmlrpc:"negociation,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PickingTypeId *Many2One `xmlrpc:"picking_type_id,omitempty"` + PriceAverage *Float `xmlrpc:"price_average,omitempty"` + PriceStandard *Float `xmlrpc:"price_standard,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"` + State *Selection `xmlrpc:"state,omitempty"` + UnitQuantity *Float `xmlrpc:"unit_quantity,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) { + return c.Create(PurchaseReportModel, pr) +} + +// 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) +} + +// 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 + } + if prs != nil && len(*prs) > 0 { + return &((*prs)[0]), nil + } + return nil, fmt.Errorf("id %v of purchase.report not found", id) +} + +// 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 + } + if prs != nil && len(*prs) > 0 { + return &((*prs)[0]), nil + } + return nil, fmt.Errorf("no purchase.report was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(PurchaseReportModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no purchase.report was found with criteria %v and options %v", criteria, options) +} diff --git a/queue_job.go b/queue_job.go new file mode 100644 index 00000000..030f3dbe --- /dev/null +++ b/queue_job.go @@ -0,0 +1,155 @@ +package odoo + +import ( + "fmt" +) + +// QueueJob represents queue.job model. +type QueueJob struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + ActivityDateDeadline *Time `xmlrpc:"activity_date_deadline,omitempty"` + ActivityIds *Relation `xmlrpc:"activity_ids,omitempty"` + ActivityState *Selection `xmlrpc:"activity_state,omitempty"` + ActivitySummary *String `xmlrpc:"activity_summary,omitempty"` + ActivityTypeId *Many2One `xmlrpc:"activity_type_id,omitempty"` + ActivityUserId *Many2One `xmlrpc:"activity_user_id,omitempty"` + Args interface{} `xmlrpc:"args,omitempty"` + Channel *String `xmlrpc:"channel,omitempty"` + ChannelMethodName *String `xmlrpc:"channel_method_name,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + DateCreated *Time `xmlrpc:"date_created,omitempty"` + DateDone *Time `xmlrpc:"date_done,omitempty"` + DateEnqueued *Time `xmlrpc:"date_enqueued,omitempty"` + DateStarted *Time `xmlrpc:"date_started,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Eta *Time `xmlrpc:"eta,omitempty"` + ExcInfo *String `xmlrpc:"exc_info,omitempty"` + FuncString *String `xmlrpc:"func_string,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + JobFunctionId *Many2One `xmlrpc:"job_function_id,omitempty"` + Kwargs interface{} `xmlrpc:"kwargs,omitempty"` + MaxRetries *Int `xmlrpc:"max_retries,omitempty"` + MessageChannelIds *Relation `xmlrpc:"message_channel_ids,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageLastPost *Time `xmlrpc:"message_last_post,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MessageUnread *Bool `xmlrpc:"message_unread,omitempty"` + MessageUnreadCounter *Int `xmlrpc:"message_unread_counter,omitempty"` + MethodName *String `xmlrpc:"method_name,omitempty"` + ModelName *String `xmlrpc:"model_name,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Priority *Int `xmlrpc:"priority,omitempty"` + RecordIds interface{} `xmlrpc:"record_ids,omitempty"` + Result *String `xmlrpc:"result,omitempty"` + Retry *Int `xmlrpc:"retry,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + Uuid *String `xmlrpc:"uuid,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` +} + +// QueueJobs represents array of queue.job model. +type QueueJobs []QueueJob + +// QueueJobModel is the odoo model name. +const QueueJobModel = "queue.job" + +// Many2One convert QueueJob to *Many2One. +func (qj *QueueJob) Many2One() *Many2One { + return NewMany2One(qj.Id.Get(), "") +} + +// CreateQueueJob creates a new queue.job model and returns its id. +func (c *Client) CreateQueueJob(qj *QueueJob) (int64, error) { + return c.Create(QueueJobModel, qj) +} + +// UpdateQueueJob updates an existing queue.job record. +func (c *Client) UpdateQueueJob(qj *QueueJob) error { + return c.UpdateQueueJobs([]int64{qj.Id.Get()}, qj) +} + +// UpdateQueueJobs updates existing queue.job records. +// All records (represented by ids) will be updated by qj values. +func (c *Client) UpdateQueueJobs(ids []int64, qj *QueueJob) error { + return c.Update(QueueJobModel, ids, qj) +} + +// DeleteQueueJob deletes an existing queue.job record. +func (c *Client) DeleteQueueJob(id int64) error { + return c.DeleteQueueJobs([]int64{id}) +} + +// DeleteQueueJobs deletes existing queue.job records. +func (c *Client) DeleteQueueJobs(ids []int64) error { + return c.Delete(QueueJobModel, ids) +} + +// GetQueueJob gets queue.job existing record. +func (c *Client) GetQueueJob(id int64) (*QueueJob, error) { + qjs, err := c.GetQueueJobs([]int64{id}) + if err != nil { + return nil, err + } + if qjs != nil && len(*qjs) > 0 { + return &((*qjs)[0]), nil + } + return nil, fmt.Errorf("id %v of queue.job not found", id) +} + +// GetQueueJobs gets queue.job existing records. +func (c *Client) GetQueueJobs(ids []int64) (*QueueJobs, error) { + qjs := &QueueJobs{} + if err := c.Read(QueueJobModel, ids, nil, qjs); err != nil { + return nil, err + } + return qjs, nil +} + +// FindQueueJob finds queue.job record by querying it with criteria. +func (c *Client) FindQueueJob(criteria *Criteria) (*QueueJob, error) { + qjs := &QueueJobs{} + if err := c.SearchRead(QueueJobModel, criteria, NewOptions().Limit(1), qjs); err != nil { + return nil, err + } + if qjs != nil && len(*qjs) > 0 { + return &((*qjs)[0]), nil + } + return nil, fmt.Errorf("no queue.job was found with criteria %v", criteria) +} + +// FindQueueJobs finds queue.job records by querying it +// and filtering it with criteria and options. +func (c *Client) FindQueueJobs(criteria *Criteria, options *Options) (*QueueJobs, error) { + qjs := &QueueJobs{} + if err := c.SearchRead(QueueJobModel, criteria, options, qjs); err != nil { + return nil, err + } + return qjs, nil +} + +// FindQueueJobIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindQueueJobIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(QueueJobModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindQueueJobId finds record id by querying it with criteria. +func (c *Client) FindQueueJobId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(QueueJobModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no queue.job was found with criteria %v and options %v", criteria, options) +} diff --git a/queue_job_channel.go b/queue_job_channel.go new file mode 100644 index 00000000..0e9d40d9 --- /dev/null +++ b/queue_job_channel.go @@ -0,0 +1,122 @@ +package odoo + +import ( + "fmt" +) + +// QueueJobChannel represents queue.job.channel model. +type QueueJobChannel struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` + Id *Int `xmlrpc:"id,omitempty"` + JobFunctionIds *Relation `xmlrpc:"job_function_ids,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + ParentId *Many2One `xmlrpc:"parent_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// QueueJobChannels represents array of queue.job.channel model. +type QueueJobChannels []QueueJobChannel + +// QueueJobChannelModel is the odoo model name. +const QueueJobChannelModel = "queue.job.channel" + +// Many2One convert QueueJobChannel to *Many2One. +func (qjc *QueueJobChannel) Many2One() *Many2One { + return NewMany2One(qjc.Id.Get(), "") +} + +// CreateQueueJobChannel creates a new queue.job.channel model and returns its id. +func (c *Client) CreateQueueJobChannel(qjc *QueueJobChannel) (int64, error) { + return c.Create(QueueJobChannelModel, qjc) +} + +// UpdateQueueJobChannel updates an existing queue.job.channel record. +func (c *Client) UpdateQueueJobChannel(qjc *QueueJobChannel) error { + return c.UpdateQueueJobChannels([]int64{qjc.Id.Get()}, qjc) +} + +// UpdateQueueJobChannels updates existing queue.job.channel records. +// All records (represented by ids) will be updated by qjc values. +func (c *Client) UpdateQueueJobChannels(ids []int64, qjc *QueueJobChannel) error { + return c.Update(QueueJobChannelModel, ids, qjc) +} + +// DeleteQueueJobChannel deletes an existing queue.job.channel record. +func (c *Client) DeleteQueueJobChannel(id int64) error { + return c.DeleteQueueJobChannels([]int64{id}) +} + +// DeleteQueueJobChannels deletes existing queue.job.channel records. +func (c *Client) DeleteQueueJobChannels(ids []int64) error { + return c.Delete(QueueJobChannelModel, ids) +} + +// GetQueueJobChannel gets queue.job.channel existing record. +func (c *Client) GetQueueJobChannel(id int64) (*QueueJobChannel, error) { + qjcs, err := c.GetQueueJobChannels([]int64{id}) + if err != nil { + return nil, err + } + if qjcs != nil && len(*qjcs) > 0 { + return &((*qjcs)[0]), nil + } + return nil, fmt.Errorf("id %v of queue.job.channel not found", id) +} + +// GetQueueJobChannels gets queue.job.channel existing records. +func (c *Client) GetQueueJobChannels(ids []int64) (*QueueJobChannels, error) { + qjcs := &QueueJobChannels{} + if err := c.Read(QueueJobChannelModel, ids, nil, qjcs); err != nil { + return nil, err + } + return qjcs, nil +} + +// FindQueueJobChannel finds queue.job.channel record by querying it with criteria. +func (c *Client) FindQueueJobChannel(criteria *Criteria) (*QueueJobChannel, error) { + qjcs := &QueueJobChannels{} + if err := c.SearchRead(QueueJobChannelModel, criteria, NewOptions().Limit(1), qjcs); err != nil { + return nil, err + } + if qjcs != nil && len(*qjcs) > 0 { + return &((*qjcs)[0]), nil + } + return nil, fmt.Errorf("no queue.job.channel was found with criteria %v", criteria) +} + +// FindQueueJobChannels finds queue.job.channel records by querying it +// and filtering it with criteria and options. +func (c *Client) FindQueueJobChannels(criteria *Criteria, options *Options) (*QueueJobChannels, error) { + qjcs := &QueueJobChannels{} + if err := c.SearchRead(QueueJobChannelModel, criteria, options, qjcs); err != nil { + return nil, err + } + return qjcs, nil +} + +// FindQueueJobChannelIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindQueueJobChannelIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(QueueJobChannelModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindQueueJobChannelId finds record id by querying it with criteria. +func (c *Client) FindQueueJobChannelId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(QueueJobChannelModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no queue.job.channel was found with criteria %v and options %v", criteria, options) +} diff --git a/queue_job_function.go b/queue_job_function.go new file mode 100644 index 00000000..f09d8da9 --- /dev/null +++ b/queue_job_function.go @@ -0,0 +1,117 @@ +package odoo + +import ( + "fmt" +) + +// QueueJobFunction represents queue.job.function model. +type QueueJobFunction struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + Channel *String `xmlrpc:"channel,omitempty"` + ChannelId *Many2One `xmlrpc:"channel_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` +} + +// QueueJobFunctions represents array of queue.job.function model. +type QueueJobFunctions []QueueJobFunction + +// QueueJobFunctionModel is the odoo model name. +const QueueJobFunctionModel = "queue.job.function" + +// Many2One convert QueueJobFunction to *Many2One. +func (qjf *QueueJobFunction) Many2One() *Many2One { + return NewMany2One(qjf.Id.Get(), "") +} + +// CreateQueueJobFunction creates a new queue.job.function model and returns its id. +func (c *Client) CreateQueueJobFunction(qjf *QueueJobFunction) (int64, error) { + return c.Create(QueueJobFunctionModel, qjf) +} + +// UpdateQueueJobFunction updates an existing queue.job.function record. +func (c *Client) UpdateQueueJobFunction(qjf *QueueJobFunction) error { + return c.UpdateQueueJobFunctions([]int64{qjf.Id.Get()}, qjf) +} + +// UpdateQueueJobFunctions updates existing queue.job.function records. +// All records (represented by ids) will be updated by qjf values. +func (c *Client) UpdateQueueJobFunctions(ids []int64, qjf *QueueJobFunction) error { + return c.Update(QueueJobFunctionModel, ids, qjf) +} + +// DeleteQueueJobFunction deletes an existing queue.job.function record. +func (c *Client) DeleteQueueJobFunction(id int64) error { + return c.DeleteQueueJobFunctions([]int64{id}) +} + +// DeleteQueueJobFunctions deletes existing queue.job.function records. +func (c *Client) DeleteQueueJobFunctions(ids []int64) error { + return c.Delete(QueueJobFunctionModel, ids) +} + +// GetQueueJobFunction gets queue.job.function existing record. +func (c *Client) GetQueueJobFunction(id int64) (*QueueJobFunction, error) { + qjfs, err := c.GetQueueJobFunctions([]int64{id}) + if err != nil { + return nil, err + } + if qjfs != nil && len(*qjfs) > 0 { + return &((*qjfs)[0]), nil + } + return nil, fmt.Errorf("id %v of queue.job.function not found", id) +} + +// GetQueueJobFunctions gets queue.job.function existing records. +func (c *Client) GetQueueJobFunctions(ids []int64) (*QueueJobFunctions, error) { + qjfs := &QueueJobFunctions{} + if err := c.Read(QueueJobFunctionModel, ids, nil, qjfs); err != nil { + return nil, err + } + return qjfs, nil +} + +// FindQueueJobFunction finds queue.job.function record by querying it with criteria. +func (c *Client) FindQueueJobFunction(criteria *Criteria) (*QueueJobFunction, error) { + qjfs := &QueueJobFunctions{} + if err := c.SearchRead(QueueJobFunctionModel, criteria, NewOptions().Limit(1), qjfs); err != nil { + return nil, err + } + if qjfs != nil && len(*qjfs) > 0 { + return &((*qjfs)[0]), nil + } + return nil, fmt.Errorf("no queue.job.function was found with criteria %v", criteria) +} + +// FindQueueJobFunctions finds queue.job.function records by querying it +// and filtering it with criteria and options. +func (c *Client) FindQueueJobFunctions(criteria *Criteria, options *Options) (*QueueJobFunctions, error) { + qjfs := &QueueJobFunctions{} + if err := c.SearchRead(QueueJobFunctionModel, criteria, options, qjfs); err != nil { + return nil, err + } + return qjfs, nil +} + +// FindQueueJobFunctionIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindQueueJobFunctionIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(QueueJobFunctionModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindQueueJobFunctionId finds record id by querying it with criteria. +func (c *Client) FindQueueJobFunctionId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(QueueJobFunctionModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no queue.job.function was found with criteria %v and options %v", criteria, options) +} diff --git a/queue_requeue_job.go b/queue_requeue_job.go new file mode 100644 index 00000000..e93c0128 --- /dev/null +++ b/queue_requeue_job.go @@ -0,0 +1,119 @@ +package odoo + +import ( + "fmt" +) + +// QueueRequeueJob represents queue.requeue.job model. +type QueueRequeueJob struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + JobIds *Relation `xmlrpc:"job_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// QueueRequeueJobs represents array of queue.requeue.job model. +type QueueRequeueJobs []QueueRequeueJob + +// QueueRequeueJobModel is the odoo model name. +const QueueRequeueJobModel = "queue.requeue.job" + +// Many2One convert QueueRequeueJob to *Many2One. +func (qrj *QueueRequeueJob) Many2One() *Many2One { + return NewMany2One(qrj.Id.Get(), "") +} + +// CreateQueueRequeueJob creates a new queue.requeue.job model and returns its id. +func (c *Client) CreateQueueRequeueJob(qrj *QueueRequeueJob) (int64, error) { + return c.Create(QueueRequeueJobModel, qrj) +} + +// UpdateQueueRequeueJob updates an existing queue.requeue.job record. +func (c *Client) UpdateQueueRequeueJob(qrj *QueueRequeueJob) error { + return c.UpdateQueueRequeueJobs([]int64{qrj.Id.Get()}, qrj) +} + +// UpdateQueueRequeueJobs updates existing queue.requeue.job records. +// All records (represented by ids) will be updated by qrj values. +func (c *Client) UpdateQueueRequeueJobs(ids []int64, qrj *QueueRequeueJob) error { + return c.Update(QueueRequeueJobModel, ids, qrj) +} + +// DeleteQueueRequeueJob deletes an existing queue.requeue.job record. +func (c *Client) DeleteQueueRequeueJob(id int64) error { + return c.DeleteQueueRequeueJobs([]int64{id}) +} + +// DeleteQueueRequeueJobs deletes existing queue.requeue.job records. +func (c *Client) DeleteQueueRequeueJobs(ids []int64) error { + return c.Delete(QueueRequeueJobModel, ids) +} + +// GetQueueRequeueJob gets queue.requeue.job existing record. +func (c *Client) GetQueueRequeueJob(id int64) (*QueueRequeueJob, error) { + qrjs, err := c.GetQueueRequeueJobs([]int64{id}) + if err != nil { + return nil, err + } + if qrjs != nil && len(*qrjs) > 0 { + return &((*qrjs)[0]), nil + } + return nil, fmt.Errorf("id %v of queue.requeue.job not found", id) +} + +// GetQueueRequeueJobs gets queue.requeue.job existing records. +func (c *Client) GetQueueRequeueJobs(ids []int64) (*QueueRequeueJobs, error) { + qrjs := &QueueRequeueJobs{} + if err := c.Read(QueueRequeueJobModel, ids, nil, qrjs); err != nil { + return nil, err + } + return qrjs, nil +} + +// FindQueueRequeueJob finds queue.requeue.job record by querying it with criteria. +func (c *Client) FindQueueRequeueJob(criteria *Criteria) (*QueueRequeueJob, error) { + qrjs := &QueueRequeueJobs{} + if err := c.SearchRead(QueueRequeueJobModel, criteria, NewOptions().Limit(1), qrjs); err != nil { + return nil, err + } + if qrjs != nil && len(*qrjs) > 0 { + return &((*qrjs)[0]), nil + } + return nil, fmt.Errorf("no queue.requeue.job was found with criteria %v", criteria) +} + +// FindQueueRequeueJobs finds queue.requeue.job records by querying it +// and filtering it with criteria and options. +func (c *Client) FindQueueRequeueJobs(criteria *Criteria, options *Options) (*QueueRequeueJobs, error) { + qrjs := &QueueRequeueJobs{} + if err := c.SearchRead(QueueRequeueJobModel, criteria, options, qrjs); err != nil { + return nil, err + } + return qrjs, nil +} + +// FindQueueRequeueJobIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindQueueRequeueJobIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(QueueRequeueJobModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindQueueRequeueJobId finds record id by querying it with criteria. +func (c *Client) FindQueueRequeueJobId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(QueueRequeueJobModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no queue.requeue.job was found with criteria %v and options %v", criteria, options) +} diff --git a/rating_mixin.go b/rating_mixin.go new file mode 100644 index 00000000..2111c909 --- /dev/null +++ b/rating_mixin.go @@ -0,0 +1,119 @@ +package odoo + +import ( + "fmt" +) + +// RatingMixin represents rating.mixin model. +type RatingMixin struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,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"` + RatingLastValue *Float `xmlrpc:"rating_last_value,omitempty"` +} + +// RatingMixins represents array of rating.mixin model. +type RatingMixins []RatingMixin + +// RatingMixinModel is the odoo model name. +const RatingMixinModel = "rating.mixin" + +// Many2One convert RatingMixin to *Many2One. +func (rm *RatingMixin) Many2One() *Many2One { + return NewMany2One(rm.Id.Get(), "") +} + +// CreateRatingMixin creates a new rating.mixin model and returns its id. +func (c *Client) CreateRatingMixin(rm *RatingMixin) (int64, error) { + return c.Create(RatingMixinModel, rm) +} + +// UpdateRatingMixin updates an existing rating.mixin record. +func (c *Client) UpdateRatingMixin(rm *RatingMixin) error { + return c.UpdateRatingMixins([]int64{rm.Id.Get()}, rm) +} + +// UpdateRatingMixins updates existing rating.mixin records. +// All records (represented by ids) will be updated by rm values. +func (c *Client) UpdateRatingMixins(ids []int64, rm *RatingMixin) error { + return c.Update(RatingMixinModel, ids, rm) +} + +// DeleteRatingMixin deletes an existing rating.mixin record. +func (c *Client) DeleteRatingMixin(id int64) error { + return c.DeleteRatingMixins([]int64{id}) +} + +// DeleteRatingMixins deletes existing rating.mixin records. +func (c *Client) DeleteRatingMixins(ids []int64) error { + return c.Delete(RatingMixinModel, ids) +} + +// GetRatingMixin gets rating.mixin existing record. +func (c *Client) GetRatingMixin(id int64) (*RatingMixin, error) { + rms, err := c.GetRatingMixins([]int64{id}) + if err != nil { + return nil, err + } + if rms != nil && len(*rms) > 0 { + return &((*rms)[0]), nil + } + return nil, fmt.Errorf("id %v of rating.mixin not found", id) +} + +// GetRatingMixins gets rating.mixin existing records. +func (c *Client) GetRatingMixins(ids []int64) (*RatingMixins, error) { + rms := &RatingMixins{} + if err := c.Read(RatingMixinModel, ids, nil, rms); err != nil { + return nil, err + } + return rms, nil +} + +// FindRatingMixin finds rating.mixin record by querying it with criteria. +func (c *Client) FindRatingMixin(criteria *Criteria) (*RatingMixin, error) { + rms := &RatingMixins{} + if err := c.SearchRead(RatingMixinModel, criteria, NewOptions().Limit(1), rms); err != nil { + return nil, err + } + if rms != nil && len(*rms) > 0 { + return &((*rms)[0]), nil + } + return nil, fmt.Errorf("no rating.mixin was found with criteria %v", criteria) +} + +// FindRatingMixins finds rating.mixin records by querying it +// and filtering it with criteria and options. +func (c *Client) FindRatingMixins(criteria *Criteria, options *Options) (*RatingMixins, error) { + rms := &RatingMixins{} + if err := c.SearchRead(RatingMixinModel, criteria, options, rms); err != nil { + return nil, err + } + return rms, nil +} + +// FindRatingMixinIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindRatingMixinIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(RatingMixinModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindRatingMixinId finds record id by querying it with criteria. +func (c *Client) FindRatingMixinId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(RatingMixinModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no rating.mixin was found with criteria %v and options %v", criteria, options) +} diff --git a/rating_rating.go b/rating_rating.go new file mode 100644 index 00000000..d7091f81 --- /dev/null +++ b/rating_rating.go @@ -0,0 +1,135 @@ +package odoo + +import ( + "fmt" +) + +// RatingRating represents rating.rating model. +type RatingRating struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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"` + MessageId *Many2One `xmlrpc:"message_id,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"` + RatedPartnerId *Many2One `xmlrpc:"rated_partner_id,omitempty"` + Rating *Float `xmlrpc:"rating,omitempty"` + RatingImage *String `xmlrpc:"rating_image,omitempty"` + RatingText *Selection `xmlrpc:"rating_text,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"` + 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) { + return c.Create(RatingRatingModel, rr) +} + +// 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) +} + +// 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 + } + if rrs != nil && len(*rrs) > 0 { + return &((*rrs)[0]), nil + } + return nil, fmt.Errorf("id %v of rating.rating not found", id) +} + +// 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 + } + if rrs != nil && len(*rrs) > 0 { + return &((*rrs)[0]), nil + } + return nil, fmt.Errorf("no rating.rating was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(RatingRatingModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no rating.rating was found with criteria %v and options %v", criteria, options) +} diff --git a/report_account_report_agedpartnerbalance.go b/report_account_report_agedpartnerbalance.go new file mode 100644 index 00000000..b76d91aa --- /dev/null +++ b/report_account_report_agedpartnerbalance.go @@ -0,0 +1,114 @@ +package odoo + +import ( + "fmt" +) + +// ReportAccountReportAgedpartnerbalance represents report.account.report_agedpartnerbalance model. +type ReportAccountReportAgedpartnerbalance struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` +} + +// ReportAccountReportAgedpartnerbalances represents array of report.account.report_agedpartnerbalance model. +type ReportAccountReportAgedpartnerbalances []ReportAccountReportAgedpartnerbalance + +// ReportAccountReportAgedpartnerbalanceModel is the odoo model name. +const ReportAccountReportAgedpartnerbalanceModel = "report.account.report_agedpartnerbalance" + +// Many2One convert ReportAccountReportAgedpartnerbalance to *Many2One. +func (rar *ReportAccountReportAgedpartnerbalance) Many2One() *Many2One { + return NewMany2One(rar.Id.Get(), "") +} + +// CreateReportAccountReportAgedpartnerbalance creates a new report.account.report_agedpartnerbalance model and returns its id. +func (c *Client) CreateReportAccountReportAgedpartnerbalance(rar *ReportAccountReportAgedpartnerbalance) (int64, error) { + return c.Create(ReportAccountReportAgedpartnerbalanceModel, rar) +} + +// UpdateReportAccountReportAgedpartnerbalance updates an existing report.account.report_agedpartnerbalance record. +func (c *Client) UpdateReportAccountReportAgedpartnerbalance(rar *ReportAccountReportAgedpartnerbalance) error { + return c.UpdateReportAccountReportAgedpartnerbalances([]int64{rar.Id.Get()}, rar) +} + +// UpdateReportAccountReportAgedpartnerbalances updates existing report.account.report_agedpartnerbalance records. +// All records (represented by ids) will be updated by rar values. +func (c *Client) UpdateReportAccountReportAgedpartnerbalances(ids []int64, rar *ReportAccountReportAgedpartnerbalance) error { + return c.Update(ReportAccountReportAgedpartnerbalanceModel, ids, rar) +} + +// DeleteReportAccountReportAgedpartnerbalance deletes an existing report.account.report_agedpartnerbalance record. +func (c *Client) DeleteReportAccountReportAgedpartnerbalance(id int64) error { + return c.DeleteReportAccountReportAgedpartnerbalances([]int64{id}) +} + +// DeleteReportAccountReportAgedpartnerbalances deletes existing report.account.report_agedpartnerbalance records. +func (c *Client) DeleteReportAccountReportAgedpartnerbalances(ids []int64) error { + return c.Delete(ReportAccountReportAgedpartnerbalanceModel, ids) +} + +// GetReportAccountReportAgedpartnerbalance gets report.account.report_agedpartnerbalance existing record. +func (c *Client) GetReportAccountReportAgedpartnerbalance(id int64) (*ReportAccountReportAgedpartnerbalance, error) { + rars, err := c.GetReportAccountReportAgedpartnerbalances([]int64{id}) + if err != nil { + return nil, err + } + if rars != nil && len(*rars) > 0 { + return &((*rars)[0]), nil + } + return nil, fmt.Errorf("id %v of report.account.report_agedpartnerbalance not found", id) +} + +// GetReportAccountReportAgedpartnerbalances gets report.account.report_agedpartnerbalance existing records. +func (c *Client) GetReportAccountReportAgedpartnerbalances(ids []int64) (*ReportAccountReportAgedpartnerbalances, error) { + rars := &ReportAccountReportAgedpartnerbalances{} + if err := c.Read(ReportAccountReportAgedpartnerbalanceModel, ids, nil, rars); err != nil { + return nil, err + } + return rars, nil +} + +// FindReportAccountReportAgedpartnerbalance finds report.account.report_agedpartnerbalance record by querying it with criteria. +func (c *Client) FindReportAccountReportAgedpartnerbalance(criteria *Criteria) (*ReportAccountReportAgedpartnerbalance, error) { + rars := &ReportAccountReportAgedpartnerbalances{} + if err := c.SearchRead(ReportAccountReportAgedpartnerbalanceModel, criteria, NewOptions().Limit(1), rars); err != nil { + return nil, err + } + if rars != nil && len(*rars) > 0 { + return &((*rars)[0]), nil + } + return nil, fmt.Errorf("no report.account.report_agedpartnerbalance was found with criteria %v", criteria) +} + +// FindReportAccountReportAgedpartnerbalances finds report.account.report_agedpartnerbalance records by querying it +// and filtering it with criteria and options. +func (c *Client) FindReportAccountReportAgedpartnerbalances(criteria *Criteria, options *Options) (*ReportAccountReportAgedpartnerbalances, error) { + rars := &ReportAccountReportAgedpartnerbalances{} + if err := c.SearchRead(ReportAccountReportAgedpartnerbalanceModel, criteria, options, rars); err != nil { + return nil, err + } + return rars, nil +} + +// FindReportAccountReportAgedpartnerbalanceIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindReportAccountReportAgedpartnerbalanceIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(ReportAccountReportAgedpartnerbalanceModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindReportAccountReportAgedpartnerbalanceId finds record id by querying it with criteria. +func (c *Client) FindReportAccountReportAgedpartnerbalanceId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ReportAccountReportAgedpartnerbalanceModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no report.account.report_agedpartnerbalance was found with criteria %v and options %v", criteria, options) +} diff --git a/report_account_report_financial.go b/report_account_report_financial.go new file mode 100644 index 00000000..60be80f3 --- /dev/null +++ b/report_account_report_financial.go @@ -0,0 +1,114 @@ +package odoo + +import ( + "fmt" +) + +// ReportAccountReportFinancial represents report.account.report_financial model. +type ReportAccountReportFinancial struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` +} + +// ReportAccountReportFinancials represents array of report.account.report_financial model. +type ReportAccountReportFinancials []ReportAccountReportFinancial + +// ReportAccountReportFinancialModel is the odoo model name. +const ReportAccountReportFinancialModel = "report.account.report_financial" + +// Many2One convert ReportAccountReportFinancial to *Many2One. +func (rar *ReportAccountReportFinancial) Many2One() *Many2One { + return NewMany2One(rar.Id.Get(), "") +} + +// CreateReportAccountReportFinancial creates a new report.account.report_financial model and returns its id. +func (c *Client) CreateReportAccountReportFinancial(rar *ReportAccountReportFinancial) (int64, error) { + return c.Create(ReportAccountReportFinancialModel, rar) +} + +// UpdateReportAccountReportFinancial updates an existing report.account.report_financial record. +func (c *Client) UpdateReportAccountReportFinancial(rar *ReportAccountReportFinancial) error { + return c.UpdateReportAccountReportFinancials([]int64{rar.Id.Get()}, rar) +} + +// UpdateReportAccountReportFinancials updates existing report.account.report_financial records. +// All records (represented by ids) will be updated by rar values. +func (c *Client) UpdateReportAccountReportFinancials(ids []int64, rar *ReportAccountReportFinancial) error { + return c.Update(ReportAccountReportFinancialModel, ids, rar) +} + +// DeleteReportAccountReportFinancial deletes an existing report.account.report_financial record. +func (c *Client) DeleteReportAccountReportFinancial(id int64) error { + return c.DeleteReportAccountReportFinancials([]int64{id}) +} + +// DeleteReportAccountReportFinancials deletes existing report.account.report_financial records. +func (c *Client) DeleteReportAccountReportFinancials(ids []int64) error { + return c.Delete(ReportAccountReportFinancialModel, ids) +} + +// GetReportAccountReportFinancial gets report.account.report_financial existing record. +func (c *Client) GetReportAccountReportFinancial(id int64) (*ReportAccountReportFinancial, error) { + rars, err := c.GetReportAccountReportFinancials([]int64{id}) + if err != nil { + return nil, err + } + if rars != nil && len(*rars) > 0 { + return &((*rars)[0]), nil + } + return nil, fmt.Errorf("id %v of report.account.report_financial not found", id) +} + +// GetReportAccountReportFinancials gets report.account.report_financial existing records. +func (c *Client) GetReportAccountReportFinancials(ids []int64) (*ReportAccountReportFinancials, error) { + rars := &ReportAccountReportFinancials{} + if err := c.Read(ReportAccountReportFinancialModel, ids, nil, rars); err != nil { + return nil, err + } + return rars, nil +} + +// FindReportAccountReportFinancial finds report.account.report_financial record by querying it with criteria. +func (c *Client) FindReportAccountReportFinancial(criteria *Criteria) (*ReportAccountReportFinancial, error) { + rars := &ReportAccountReportFinancials{} + if err := c.SearchRead(ReportAccountReportFinancialModel, criteria, NewOptions().Limit(1), rars); err != nil { + return nil, err + } + if rars != nil && len(*rars) > 0 { + return &((*rars)[0]), nil + } + return nil, fmt.Errorf("no report.account.report_financial was found with criteria %v", criteria) +} + +// FindReportAccountReportFinancials finds report.account.report_financial records by querying it +// and filtering it with criteria and options. +func (c *Client) FindReportAccountReportFinancials(criteria *Criteria, options *Options) (*ReportAccountReportFinancials, error) { + rars := &ReportAccountReportFinancials{} + if err := c.SearchRead(ReportAccountReportFinancialModel, criteria, options, rars); err != nil { + return nil, err + } + return rars, nil +} + +// FindReportAccountReportFinancialIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindReportAccountReportFinancialIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(ReportAccountReportFinancialModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindReportAccountReportFinancialId finds record id by querying it with criteria. +func (c *Client) FindReportAccountReportFinancialId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ReportAccountReportFinancialModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no report.account.report_financial was found with criteria %v and options %v", criteria, options) +} diff --git a/report_account_report_generalledger.go b/report_account_report_generalledger.go new file mode 100644 index 00000000..3b673887 --- /dev/null +++ b/report_account_report_generalledger.go @@ -0,0 +1,114 @@ +package odoo + +import ( + "fmt" +) + +// ReportAccountReportGeneralledger represents report.account.report_generalledger model. +type ReportAccountReportGeneralledger struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` +} + +// ReportAccountReportGeneralledgers represents array of report.account.report_generalledger model. +type ReportAccountReportGeneralledgers []ReportAccountReportGeneralledger + +// ReportAccountReportGeneralledgerModel is the odoo model name. +const ReportAccountReportGeneralledgerModel = "report.account.report_generalledger" + +// Many2One convert ReportAccountReportGeneralledger to *Many2One. +func (rar *ReportAccountReportGeneralledger) Many2One() *Many2One { + return NewMany2One(rar.Id.Get(), "") +} + +// CreateReportAccountReportGeneralledger creates a new report.account.report_generalledger model and returns its id. +func (c *Client) CreateReportAccountReportGeneralledger(rar *ReportAccountReportGeneralledger) (int64, error) { + return c.Create(ReportAccountReportGeneralledgerModel, rar) +} + +// UpdateReportAccountReportGeneralledger updates an existing report.account.report_generalledger record. +func (c *Client) UpdateReportAccountReportGeneralledger(rar *ReportAccountReportGeneralledger) error { + return c.UpdateReportAccountReportGeneralledgers([]int64{rar.Id.Get()}, rar) +} + +// UpdateReportAccountReportGeneralledgers updates existing report.account.report_generalledger records. +// All records (represented by ids) will be updated by rar values. +func (c *Client) UpdateReportAccountReportGeneralledgers(ids []int64, rar *ReportAccountReportGeneralledger) error { + return c.Update(ReportAccountReportGeneralledgerModel, ids, rar) +} + +// DeleteReportAccountReportGeneralledger deletes an existing report.account.report_generalledger record. +func (c *Client) DeleteReportAccountReportGeneralledger(id int64) error { + return c.DeleteReportAccountReportGeneralledgers([]int64{id}) +} + +// DeleteReportAccountReportGeneralledgers deletes existing report.account.report_generalledger records. +func (c *Client) DeleteReportAccountReportGeneralledgers(ids []int64) error { + return c.Delete(ReportAccountReportGeneralledgerModel, ids) +} + +// GetReportAccountReportGeneralledger gets report.account.report_generalledger existing record. +func (c *Client) GetReportAccountReportGeneralledger(id int64) (*ReportAccountReportGeneralledger, error) { + rars, err := c.GetReportAccountReportGeneralledgers([]int64{id}) + if err != nil { + return nil, err + } + if rars != nil && len(*rars) > 0 { + return &((*rars)[0]), nil + } + return nil, fmt.Errorf("id %v of report.account.report_generalledger not found", id) +} + +// GetReportAccountReportGeneralledgers gets report.account.report_generalledger existing records. +func (c *Client) GetReportAccountReportGeneralledgers(ids []int64) (*ReportAccountReportGeneralledgers, error) { + rars := &ReportAccountReportGeneralledgers{} + if err := c.Read(ReportAccountReportGeneralledgerModel, ids, nil, rars); err != nil { + return nil, err + } + return rars, nil +} + +// FindReportAccountReportGeneralledger finds report.account.report_generalledger record by querying it with criteria. +func (c *Client) FindReportAccountReportGeneralledger(criteria *Criteria) (*ReportAccountReportGeneralledger, error) { + rars := &ReportAccountReportGeneralledgers{} + if err := c.SearchRead(ReportAccountReportGeneralledgerModel, criteria, NewOptions().Limit(1), rars); err != nil { + return nil, err + } + if rars != nil && len(*rars) > 0 { + return &((*rars)[0]), nil + } + return nil, fmt.Errorf("no report.account.report_generalledger was found with criteria %v", criteria) +} + +// FindReportAccountReportGeneralledgers finds report.account.report_generalledger records by querying it +// and filtering it with criteria and options. +func (c *Client) FindReportAccountReportGeneralledgers(criteria *Criteria, options *Options) (*ReportAccountReportGeneralledgers, error) { + rars := &ReportAccountReportGeneralledgers{} + if err := c.SearchRead(ReportAccountReportGeneralledgerModel, criteria, options, rars); err != nil { + return nil, err + } + return rars, nil +} + +// FindReportAccountReportGeneralledgerIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindReportAccountReportGeneralledgerIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(ReportAccountReportGeneralledgerModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindReportAccountReportGeneralledgerId finds record id by querying it with criteria. +func (c *Client) FindReportAccountReportGeneralledgerId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ReportAccountReportGeneralledgerModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no report.account.report_generalledger was found with criteria %v and options %v", criteria, options) +} diff --git a/report_account_report_journal.go b/report_account_report_journal.go new file mode 100644 index 00000000..62fc3da9 --- /dev/null +++ b/report_account_report_journal.go @@ -0,0 +1,114 @@ +package odoo + +import ( + "fmt" +) + +// ReportAccountReportJournal represents report.account.report_journal model. +type ReportAccountReportJournal struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` +} + +// ReportAccountReportJournals represents array of report.account.report_journal model. +type ReportAccountReportJournals []ReportAccountReportJournal + +// ReportAccountReportJournalModel is the odoo model name. +const ReportAccountReportJournalModel = "report.account.report_journal" + +// Many2One convert ReportAccountReportJournal to *Many2One. +func (rar *ReportAccountReportJournal) Many2One() *Many2One { + return NewMany2One(rar.Id.Get(), "") +} + +// CreateReportAccountReportJournal creates a new report.account.report_journal model and returns its id. +func (c *Client) CreateReportAccountReportJournal(rar *ReportAccountReportJournal) (int64, error) { + return c.Create(ReportAccountReportJournalModel, rar) +} + +// UpdateReportAccountReportJournal updates an existing report.account.report_journal record. +func (c *Client) UpdateReportAccountReportJournal(rar *ReportAccountReportJournal) error { + return c.UpdateReportAccountReportJournals([]int64{rar.Id.Get()}, rar) +} + +// UpdateReportAccountReportJournals updates existing report.account.report_journal records. +// All records (represented by ids) will be updated by rar values. +func (c *Client) UpdateReportAccountReportJournals(ids []int64, rar *ReportAccountReportJournal) error { + return c.Update(ReportAccountReportJournalModel, ids, rar) +} + +// DeleteReportAccountReportJournal deletes an existing report.account.report_journal record. +func (c *Client) DeleteReportAccountReportJournal(id int64) error { + return c.DeleteReportAccountReportJournals([]int64{id}) +} + +// DeleteReportAccountReportJournals deletes existing report.account.report_journal records. +func (c *Client) DeleteReportAccountReportJournals(ids []int64) error { + return c.Delete(ReportAccountReportJournalModel, ids) +} + +// GetReportAccountReportJournal gets report.account.report_journal existing record. +func (c *Client) GetReportAccountReportJournal(id int64) (*ReportAccountReportJournal, error) { + rars, err := c.GetReportAccountReportJournals([]int64{id}) + if err != nil { + return nil, err + } + if rars != nil && len(*rars) > 0 { + return &((*rars)[0]), nil + } + return nil, fmt.Errorf("id %v of report.account.report_journal not found", id) +} + +// GetReportAccountReportJournals gets report.account.report_journal existing records. +func (c *Client) GetReportAccountReportJournals(ids []int64) (*ReportAccountReportJournals, error) { + rars := &ReportAccountReportJournals{} + if err := c.Read(ReportAccountReportJournalModel, ids, nil, rars); err != nil { + return nil, err + } + return rars, nil +} + +// FindReportAccountReportJournal finds report.account.report_journal record by querying it with criteria. +func (c *Client) FindReportAccountReportJournal(criteria *Criteria) (*ReportAccountReportJournal, error) { + rars := &ReportAccountReportJournals{} + if err := c.SearchRead(ReportAccountReportJournalModel, criteria, NewOptions().Limit(1), rars); err != nil { + return nil, err + } + if rars != nil && len(*rars) > 0 { + return &((*rars)[0]), nil + } + return nil, fmt.Errorf("no report.account.report_journal was found with criteria %v", criteria) +} + +// FindReportAccountReportJournals finds report.account.report_journal records by querying it +// and filtering it with criteria and options. +func (c *Client) FindReportAccountReportJournals(criteria *Criteria, options *Options) (*ReportAccountReportJournals, error) { + rars := &ReportAccountReportJournals{} + if err := c.SearchRead(ReportAccountReportJournalModel, criteria, options, rars); err != nil { + return nil, err + } + return rars, nil +} + +// FindReportAccountReportJournalIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindReportAccountReportJournalIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(ReportAccountReportJournalModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindReportAccountReportJournalId finds record id by querying it with criteria. +func (c *Client) FindReportAccountReportJournalId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ReportAccountReportJournalModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no report.account.report_journal was found with criteria %v and options %v", criteria, options) +} diff --git a/report_account_report_overdue.go b/report_account_report_overdue.go new file mode 100644 index 00000000..f1b63568 --- /dev/null +++ b/report_account_report_overdue.go @@ -0,0 +1,114 @@ +package odoo + +import ( + "fmt" +) + +// ReportAccountReportOverdue represents report.account.report_overdue model. +type ReportAccountReportOverdue struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` +} + +// ReportAccountReportOverdues represents array of report.account.report_overdue model. +type ReportAccountReportOverdues []ReportAccountReportOverdue + +// ReportAccountReportOverdueModel is the odoo model name. +const ReportAccountReportOverdueModel = "report.account.report_overdue" + +// Many2One convert ReportAccountReportOverdue to *Many2One. +func (rar *ReportAccountReportOverdue) Many2One() *Many2One { + return NewMany2One(rar.Id.Get(), "") +} + +// CreateReportAccountReportOverdue creates a new report.account.report_overdue model and returns its id. +func (c *Client) CreateReportAccountReportOverdue(rar *ReportAccountReportOverdue) (int64, error) { + return c.Create(ReportAccountReportOverdueModel, rar) +} + +// UpdateReportAccountReportOverdue updates an existing report.account.report_overdue record. +func (c *Client) UpdateReportAccountReportOverdue(rar *ReportAccountReportOverdue) error { + return c.UpdateReportAccountReportOverdues([]int64{rar.Id.Get()}, rar) +} + +// UpdateReportAccountReportOverdues updates existing report.account.report_overdue records. +// All records (represented by ids) will be updated by rar values. +func (c *Client) UpdateReportAccountReportOverdues(ids []int64, rar *ReportAccountReportOverdue) error { + return c.Update(ReportAccountReportOverdueModel, ids, rar) +} + +// DeleteReportAccountReportOverdue deletes an existing report.account.report_overdue record. +func (c *Client) DeleteReportAccountReportOverdue(id int64) error { + return c.DeleteReportAccountReportOverdues([]int64{id}) +} + +// DeleteReportAccountReportOverdues deletes existing report.account.report_overdue records. +func (c *Client) DeleteReportAccountReportOverdues(ids []int64) error { + return c.Delete(ReportAccountReportOverdueModel, ids) +} + +// GetReportAccountReportOverdue gets report.account.report_overdue existing record. +func (c *Client) GetReportAccountReportOverdue(id int64) (*ReportAccountReportOverdue, error) { + rars, err := c.GetReportAccountReportOverdues([]int64{id}) + if err != nil { + return nil, err + } + if rars != nil && len(*rars) > 0 { + return &((*rars)[0]), nil + } + return nil, fmt.Errorf("id %v of report.account.report_overdue not found", id) +} + +// GetReportAccountReportOverdues gets report.account.report_overdue existing records. +func (c *Client) GetReportAccountReportOverdues(ids []int64) (*ReportAccountReportOverdues, error) { + rars := &ReportAccountReportOverdues{} + if err := c.Read(ReportAccountReportOverdueModel, ids, nil, rars); err != nil { + return nil, err + } + return rars, nil +} + +// FindReportAccountReportOverdue finds report.account.report_overdue record by querying it with criteria. +func (c *Client) FindReportAccountReportOverdue(criteria *Criteria) (*ReportAccountReportOverdue, error) { + rars := &ReportAccountReportOverdues{} + if err := c.SearchRead(ReportAccountReportOverdueModel, criteria, NewOptions().Limit(1), rars); err != nil { + return nil, err + } + if rars != nil && len(*rars) > 0 { + return &((*rars)[0]), nil + } + return nil, fmt.Errorf("no report.account.report_overdue was found with criteria %v", criteria) +} + +// FindReportAccountReportOverdues finds report.account.report_overdue records by querying it +// and filtering it with criteria and options. +func (c *Client) FindReportAccountReportOverdues(criteria *Criteria, options *Options) (*ReportAccountReportOverdues, error) { + rars := &ReportAccountReportOverdues{} + if err := c.SearchRead(ReportAccountReportOverdueModel, criteria, options, rars); err != nil { + return nil, err + } + return rars, nil +} + +// FindReportAccountReportOverdueIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindReportAccountReportOverdueIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(ReportAccountReportOverdueModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindReportAccountReportOverdueId finds record id by querying it with criteria. +func (c *Client) FindReportAccountReportOverdueId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ReportAccountReportOverdueModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no report.account.report_overdue was found with criteria %v and options %v", criteria, options) +} diff --git a/report_account_report_partnerledger.go b/report_account_report_partnerledger.go new file mode 100644 index 00000000..e39d5895 --- /dev/null +++ b/report_account_report_partnerledger.go @@ -0,0 +1,114 @@ +package odoo + +import ( + "fmt" +) + +// ReportAccountReportPartnerledger represents report.account.report_partnerledger model. +type ReportAccountReportPartnerledger struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` +} + +// ReportAccountReportPartnerledgers represents array of report.account.report_partnerledger model. +type ReportAccountReportPartnerledgers []ReportAccountReportPartnerledger + +// ReportAccountReportPartnerledgerModel is the odoo model name. +const ReportAccountReportPartnerledgerModel = "report.account.report_partnerledger" + +// Many2One convert ReportAccountReportPartnerledger to *Many2One. +func (rar *ReportAccountReportPartnerledger) Many2One() *Many2One { + return NewMany2One(rar.Id.Get(), "") +} + +// CreateReportAccountReportPartnerledger creates a new report.account.report_partnerledger model and returns its id. +func (c *Client) CreateReportAccountReportPartnerledger(rar *ReportAccountReportPartnerledger) (int64, error) { + return c.Create(ReportAccountReportPartnerledgerModel, rar) +} + +// UpdateReportAccountReportPartnerledger updates an existing report.account.report_partnerledger record. +func (c *Client) UpdateReportAccountReportPartnerledger(rar *ReportAccountReportPartnerledger) error { + return c.UpdateReportAccountReportPartnerledgers([]int64{rar.Id.Get()}, rar) +} + +// UpdateReportAccountReportPartnerledgers updates existing report.account.report_partnerledger records. +// All records (represented by ids) will be updated by rar values. +func (c *Client) UpdateReportAccountReportPartnerledgers(ids []int64, rar *ReportAccountReportPartnerledger) error { + return c.Update(ReportAccountReportPartnerledgerModel, ids, rar) +} + +// DeleteReportAccountReportPartnerledger deletes an existing report.account.report_partnerledger record. +func (c *Client) DeleteReportAccountReportPartnerledger(id int64) error { + return c.DeleteReportAccountReportPartnerledgers([]int64{id}) +} + +// DeleteReportAccountReportPartnerledgers deletes existing report.account.report_partnerledger records. +func (c *Client) DeleteReportAccountReportPartnerledgers(ids []int64) error { + return c.Delete(ReportAccountReportPartnerledgerModel, ids) +} + +// GetReportAccountReportPartnerledger gets report.account.report_partnerledger existing record. +func (c *Client) GetReportAccountReportPartnerledger(id int64) (*ReportAccountReportPartnerledger, error) { + rars, err := c.GetReportAccountReportPartnerledgers([]int64{id}) + if err != nil { + return nil, err + } + if rars != nil && len(*rars) > 0 { + return &((*rars)[0]), nil + } + return nil, fmt.Errorf("id %v of report.account.report_partnerledger not found", id) +} + +// GetReportAccountReportPartnerledgers gets report.account.report_partnerledger existing records. +func (c *Client) GetReportAccountReportPartnerledgers(ids []int64) (*ReportAccountReportPartnerledgers, error) { + rars := &ReportAccountReportPartnerledgers{} + if err := c.Read(ReportAccountReportPartnerledgerModel, ids, nil, rars); err != nil { + return nil, err + } + return rars, nil +} + +// FindReportAccountReportPartnerledger finds report.account.report_partnerledger record by querying it with criteria. +func (c *Client) FindReportAccountReportPartnerledger(criteria *Criteria) (*ReportAccountReportPartnerledger, error) { + rars := &ReportAccountReportPartnerledgers{} + if err := c.SearchRead(ReportAccountReportPartnerledgerModel, criteria, NewOptions().Limit(1), rars); err != nil { + return nil, err + } + if rars != nil && len(*rars) > 0 { + return &((*rars)[0]), nil + } + return nil, fmt.Errorf("no report.account.report_partnerledger was found with criteria %v", criteria) +} + +// FindReportAccountReportPartnerledgers finds report.account.report_partnerledger records by querying it +// and filtering it with criteria and options. +func (c *Client) FindReportAccountReportPartnerledgers(criteria *Criteria, options *Options) (*ReportAccountReportPartnerledgers, error) { + rars := &ReportAccountReportPartnerledgers{} + if err := c.SearchRead(ReportAccountReportPartnerledgerModel, criteria, options, rars); err != nil { + return nil, err + } + return rars, nil +} + +// FindReportAccountReportPartnerledgerIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindReportAccountReportPartnerledgerIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(ReportAccountReportPartnerledgerModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindReportAccountReportPartnerledgerId finds record id by querying it with criteria. +func (c *Client) FindReportAccountReportPartnerledgerId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ReportAccountReportPartnerledgerModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no report.account.report_partnerledger was found with criteria %v and options %v", criteria, options) +} diff --git a/report_account_report_tax.go b/report_account_report_tax.go new file mode 100644 index 00000000..85a63576 --- /dev/null +++ b/report_account_report_tax.go @@ -0,0 +1,114 @@ +package odoo + +import ( + "fmt" +) + +// ReportAccountReportTax represents report.account.report_tax model. +type ReportAccountReportTax struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` +} + +// ReportAccountReportTaxs represents array of report.account.report_tax model. +type ReportAccountReportTaxs []ReportAccountReportTax + +// ReportAccountReportTaxModel is the odoo model name. +const ReportAccountReportTaxModel = "report.account.report_tax" + +// Many2One convert ReportAccountReportTax to *Many2One. +func (rar *ReportAccountReportTax) Many2One() *Many2One { + return NewMany2One(rar.Id.Get(), "") +} + +// CreateReportAccountReportTax creates a new report.account.report_tax model and returns its id. +func (c *Client) CreateReportAccountReportTax(rar *ReportAccountReportTax) (int64, error) { + return c.Create(ReportAccountReportTaxModel, rar) +} + +// UpdateReportAccountReportTax updates an existing report.account.report_tax record. +func (c *Client) UpdateReportAccountReportTax(rar *ReportAccountReportTax) error { + return c.UpdateReportAccountReportTaxs([]int64{rar.Id.Get()}, rar) +} + +// UpdateReportAccountReportTaxs updates existing report.account.report_tax records. +// All records (represented by ids) will be updated by rar values. +func (c *Client) UpdateReportAccountReportTaxs(ids []int64, rar *ReportAccountReportTax) error { + return c.Update(ReportAccountReportTaxModel, ids, rar) +} + +// DeleteReportAccountReportTax deletes an existing report.account.report_tax record. +func (c *Client) DeleteReportAccountReportTax(id int64) error { + return c.DeleteReportAccountReportTaxs([]int64{id}) +} + +// DeleteReportAccountReportTaxs deletes existing report.account.report_tax records. +func (c *Client) DeleteReportAccountReportTaxs(ids []int64) error { + return c.Delete(ReportAccountReportTaxModel, ids) +} + +// GetReportAccountReportTax gets report.account.report_tax existing record. +func (c *Client) GetReportAccountReportTax(id int64) (*ReportAccountReportTax, error) { + rars, err := c.GetReportAccountReportTaxs([]int64{id}) + if err != nil { + return nil, err + } + if rars != nil && len(*rars) > 0 { + return &((*rars)[0]), nil + } + return nil, fmt.Errorf("id %v of report.account.report_tax not found", id) +} + +// GetReportAccountReportTaxs gets report.account.report_tax existing records. +func (c *Client) GetReportAccountReportTaxs(ids []int64) (*ReportAccountReportTaxs, error) { + rars := &ReportAccountReportTaxs{} + if err := c.Read(ReportAccountReportTaxModel, ids, nil, rars); err != nil { + return nil, err + } + return rars, nil +} + +// FindReportAccountReportTax finds report.account.report_tax record by querying it with criteria. +func (c *Client) FindReportAccountReportTax(criteria *Criteria) (*ReportAccountReportTax, error) { + rars := &ReportAccountReportTaxs{} + if err := c.SearchRead(ReportAccountReportTaxModel, criteria, NewOptions().Limit(1), rars); err != nil { + return nil, err + } + if rars != nil && len(*rars) > 0 { + return &((*rars)[0]), nil + } + return nil, fmt.Errorf("no report.account.report_tax was found with criteria %v", criteria) +} + +// FindReportAccountReportTaxs finds report.account.report_tax records by querying it +// and filtering it with criteria and options. +func (c *Client) FindReportAccountReportTaxs(criteria *Criteria, options *Options) (*ReportAccountReportTaxs, error) { + rars := &ReportAccountReportTaxs{} + if err := c.SearchRead(ReportAccountReportTaxModel, criteria, options, rars); err != nil { + return nil, err + } + return rars, nil +} + +// FindReportAccountReportTaxIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindReportAccountReportTaxIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(ReportAccountReportTaxModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindReportAccountReportTaxId finds record id by querying it with criteria. +func (c *Client) FindReportAccountReportTaxId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ReportAccountReportTaxModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no report.account.report_tax was found with criteria %v and options %v", criteria, options) +} diff --git a/report_account_report_trialbalance.go b/report_account_report_trialbalance.go new file mode 100644 index 00000000..5f9ab409 --- /dev/null +++ b/report_account_report_trialbalance.go @@ -0,0 +1,114 @@ +package odoo + +import ( + "fmt" +) + +// ReportAccountReportTrialbalance represents report.account.report_trialbalance model. +type ReportAccountReportTrialbalance struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` +} + +// ReportAccountReportTrialbalances represents array of report.account.report_trialbalance model. +type ReportAccountReportTrialbalances []ReportAccountReportTrialbalance + +// ReportAccountReportTrialbalanceModel is the odoo model name. +const ReportAccountReportTrialbalanceModel = "report.account.report_trialbalance" + +// Many2One convert ReportAccountReportTrialbalance to *Many2One. +func (rar *ReportAccountReportTrialbalance) Many2One() *Many2One { + return NewMany2One(rar.Id.Get(), "") +} + +// CreateReportAccountReportTrialbalance creates a new report.account.report_trialbalance model and returns its id. +func (c *Client) CreateReportAccountReportTrialbalance(rar *ReportAccountReportTrialbalance) (int64, error) { + return c.Create(ReportAccountReportTrialbalanceModel, rar) +} + +// UpdateReportAccountReportTrialbalance updates an existing report.account.report_trialbalance record. +func (c *Client) UpdateReportAccountReportTrialbalance(rar *ReportAccountReportTrialbalance) error { + return c.UpdateReportAccountReportTrialbalances([]int64{rar.Id.Get()}, rar) +} + +// UpdateReportAccountReportTrialbalances updates existing report.account.report_trialbalance records. +// All records (represented by ids) will be updated by rar values. +func (c *Client) UpdateReportAccountReportTrialbalances(ids []int64, rar *ReportAccountReportTrialbalance) error { + return c.Update(ReportAccountReportTrialbalanceModel, ids, rar) +} + +// DeleteReportAccountReportTrialbalance deletes an existing report.account.report_trialbalance record. +func (c *Client) DeleteReportAccountReportTrialbalance(id int64) error { + return c.DeleteReportAccountReportTrialbalances([]int64{id}) +} + +// DeleteReportAccountReportTrialbalances deletes existing report.account.report_trialbalance records. +func (c *Client) DeleteReportAccountReportTrialbalances(ids []int64) error { + return c.Delete(ReportAccountReportTrialbalanceModel, ids) +} + +// GetReportAccountReportTrialbalance gets report.account.report_trialbalance existing record. +func (c *Client) GetReportAccountReportTrialbalance(id int64) (*ReportAccountReportTrialbalance, error) { + rars, err := c.GetReportAccountReportTrialbalances([]int64{id}) + if err != nil { + return nil, err + } + if rars != nil && len(*rars) > 0 { + return &((*rars)[0]), nil + } + return nil, fmt.Errorf("id %v of report.account.report_trialbalance not found", id) +} + +// GetReportAccountReportTrialbalances gets report.account.report_trialbalance existing records. +func (c *Client) GetReportAccountReportTrialbalances(ids []int64) (*ReportAccountReportTrialbalances, error) { + rars := &ReportAccountReportTrialbalances{} + if err := c.Read(ReportAccountReportTrialbalanceModel, ids, nil, rars); err != nil { + return nil, err + } + return rars, nil +} + +// FindReportAccountReportTrialbalance finds report.account.report_trialbalance record by querying it with criteria. +func (c *Client) FindReportAccountReportTrialbalance(criteria *Criteria) (*ReportAccountReportTrialbalance, error) { + rars := &ReportAccountReportTrialbalances{} + if err := c.SearchRead(ReportAccountReportTrialbalanceModel, criteria, NewOptions().Limit(1), rars); err != nil { + return nil, err + } + if rars != nil && len(*rars) > 0 { + return &((*rars)[0]), nil + } + return nil, fmt.Errorf("no report.account.report_trialbalance was found with criteria %v", criteria) +} + +// FindReportAccountReportTrialbalances finds report.account.report_trialbalance records by querying it +// and filtering it with criteria and options. +func (c *Client) FindReportAccountReportTrialbalances(criteria *Criteria, options *Options) (*ReportAccountReportTrialbalances, error) { + rars := &ReportAccountReportTrialbalances{} + if err := c.SearchRead(ReportAccountReportTrialbalanceModel, criteria, options, rars); err != nil { + return nil, err + } + return rars, nil +} + +// FindReportAccountReportTrialbalanceIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindReportAccountReportTrialbalanceIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(ReportAccountReportTrialbalanceModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindReportAccountReportTrialbalanceId finds record id by querying it with criteria. +func (c *Client) FindReportAccountReportTrialbalanceId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ReportAccountReportTrialbalanceModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no report.account.report_trialbalance was found with criteria %v and options %v", criteria, options) +} diff --git a/report_all_channels_sales.go b/report_all_channels_sales.go new file mode 100644 index 00000000..a875060a --- /dev/null +++ b/report_all_channels_sales.go @@ -0,0 +1,129 @@ +package odoo + +import ( + "fmt" +) + +// ReportAllChannelsSales represents report.all.channels.sales model. +type ReportAllChannelsSales struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AnalyticAccountId *Many2One `xmlrpc:"analytic_account_id,omitempty"` + CategId *Many2One `xmlrpc:"categ_id,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CountryId *Many2One `xmlrpc:"country_id,omitempty"` + DateOrder *Time `xmlrpc:"date_order,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PriceSubtotal *Float `xmlrpc:"price_subtotal,omitempty"` + PriceTotal *Float `xmlrpc:"price_total,omitempty"` + PricelistId *Many2One `xmlrpc:"pricelist_id,omitempty"` + ProductId *Many2One `xmlrpc:"product_id,omitempty"` + ProductQty *Float `xmlrpc:"product_qty,omitempty"` + ProductTmplId *Many2One `xmlrpc:"product_tmpl_id,omitempty"` + TeamId *Many2One `xmlrpc:"team_id,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` +} + +// ReportAllChannelsSaless represents array of report.all.channels.sales model. +type ReportAllChannelsSaless []ReportAllChannelsSales + +// ReportAllChannelsSalesModel is the odoo model name. +const ReportAllChannelsSalesModel = "report.all.channels.sales" + +// Many2One convert ReportAllChannelsSales to *Many2One. +func (racs *ReportAllChannelsSales) Many2One() *Many2One { + return NewMany2One(racs.Id.Get(), "") +} + +// CreateReportAllChannelsSales creates a new report.all.channels.sales model and returns its id. +func (c *Client) CreateReportAllChannelsSales(racs *ReportAllChannelsSales) (int64, error) { + return c.Create(ReportAllChannelsSalesModel, racs) +} + +// UpdateReportAllChannelsSales updates an existing report.all.channels.sales record. +func (c *Client) UpdateReportAllChannelsSales(racs *ReportAllChannelsSales) error { + return c.UpdateReportAllChannelsSaless([]int64{racs.Id.Get()}, racs) +} + +// UpdateReportAllChannelsSaless updates existing report.all.channels.sales records. +// All records (represented by ids) will be updated by racs values. +func (c *Client) UpdateReportAllChannelsSaless(ids []int64, racs *ReportAllChannelsSales) error { + return c.Update(ReportAllChannelsSalesModel, ids, racs) +} + +// DeleteReportAllChannelsSales deletes an existing report.all.channels.sales record. +func (c *Client) DeleteReportAllChannelsSales(id int64) error { + return c.DeleteReportAllChannelsSaless([]int64{id}) +} + +// DeleteReportAllChannelsSaless deletes existing report.all.channels.sales records. +func (c *Client) DeleteReportAllChannelsSaless(ids []int64) error { + return c.Delete(ReportAllChannelsSalesModel, ids) +} + +// GetReportAllChannelsSales gets report.all.channels.sales existing record. +func (c *Client) GetReportAllChannelsSales(id int64) (*ReportAllChannelsSales, error) { + racss, err := c.GetReportAllChannelsSaless([]int64{id}) + if err != nil { + return nil, err + } + if racss != nil && len(*racss) > 0 { + return &((*racss)[0]), nil + } + return nil, fmt.Errorf("id %v of report.all.channels.sales not found", id) +} + +// GetReportAllChannelsSaless gets report.all.channels.sales existing records. +func (c *Client) GetReportAllChannelsSaless(ids []int64) (*ReportAllChannelsSaless, error) { + racss := &ReportAllChannelsSaless{} + if err := c.Read(ReportAllChannelsSalesModel, ids, nil, racss); err != nil { + return nil, err + } + return racss, nil +} + +// FindReportAllChannelsSales finds report.all.channels.sales record by querying it with criteria. +func (c *Client) FindReportAllChannelsSales(criteria *Criteria) (*ReportAllChannelsSales, error) { + racss := &ReportAllChannelsSaless{} + if err := c.SearchRead(ReportAllChannelsSalesModel, criteria, NewOptions().Limit(1), racss); err != nil { + return nil, err + } + if racss != nil && len(*racss) > 0 { + return &((*racss)[0]), nil + } + return nil, fmt.Errorf("no report.all.channels.sales was found with criteria %v", criteria) +} + +// FindReportAllChannelsSaless finds report.all.channels.sales records by querying it +// and filtering it with criteria and options. +func (c *Client) FindReportAllChannelsSaless(criteria *Criteria, options *Options) (*ReportAllChannelsSaless, error) { + racss := &ReportAllChannelsSaless{} + if err := c.SearchRead(ReportAllChannelsSalesModel, criteria, options, racss); err != nil { + return nil, err + } + return racss, nil +} + +// FindReportAllChannelsSalesIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindReportAllChannelsSalesIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(ReportAllChannelsSalesModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindReportAllChannelsSalesId finds record id by querying it with criteria. +func (c *Client) FindReportAllChannelsSalesId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ReportAllChannelsSalesModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no report.all.channels.sales was found with criteria %v and options %v", criteria, options) +} diff --git a/report_base_report_irmodulereference.go b/report_base_report_irmodulereference.go new file mode 100644 index 00000000..534d3ae7 --- /dev/null +++ b/report_base_report_irmodulereference.go @@ -0,0 +1,114 @@ +package odoo + +import ( + "fmt" +) + +// ReportBaseReportIrmodulereference represents report.base.report_irmodulereference model. +type ReportBaseReportIrmodulereference struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` +} + +// ReportBaseReportIrmodulereferences represents array of report.base.report_irmodulereference model. +type ReportBaseReportIrmodulereferences []ReportBaseReportIrmodulereference + +// ReportBaseReportIrmodulereferenceModel is the odoo model name. +const ReportBaseReportIrmodulereferenceModel = "report.base.report_irmodulereference" + +// Many2One convert ReportBaseReportIrmodulereference to *Many2One. +func (rbr *ReportBaseReportIrmodulereference) Many2One() *Many2One { + return NewMany2One(rbr.Id.Get(), "") +} + +// CreateReportBaseReportIrmodulereference creates a new report.base.report_irmodulereference model and returns its id. +func (c *Client) CreateReportBaseReportIrmodulereference(rbr *ReportBaseReportIrmodulereference) (int64, error) { + return c.Create(ReportBaseReportIrmodulereferenceModel, rbr) +} + +// UpdateReportBaseReportIrmodulereference updates an existing report.base.report_irmodulereference record. +func (c *Client) UpdateReportBaseReportIrmodulereference(rbr *ReportBaseReportIrmodulereference) error { + return c.UpdateReportBaseReportIrmodulereferences([]int64{rbr.Id.Get()}, rbr) +} + +// UpdateReportBaseReportIrmodulereferences updates existing report.base.report_irmodulereference records. +// All records (represented by ids) will be updated by rbr values. +func (c *Client) UpdateReportBaseReportIrmodulereferences(ids []int64, rbr *ReportBaseReportIrmodulereference) error { + return c.Update(ReportBaseReportIrmodulereferenceModel, ids, rbr) +} + +// DeleteReportBaseReportIrmodulereference deletes an existing report.base.report_irmodulereference record. +func (c *Client) DeleteReportBaseReportIrmodulereference(id int64) error { + return c.DeleteReportBaseReportIrmodulereferences([]int64{id}) +} + +// DeleteReportBaseReportIrmodulereferences deletes existing report.base.report_irmodulereference records. +func (c *Client) DeleteReportBaseReportIrmodulereferences(ids []int64) error { + return c.Delete(ReportBaseReportIrmodulereferenceModel, ids) +} + +// GetReportBaseReportIrmodulereference gets report.base.report_irmodulereference existing record. +func (c *Client) GetReportBaseReportIrmodulereference(id int64) (*ReportBaseReportIrmodulereference, error) { + rbrs, err := c.GetReportBaseReportIrmodulereferences([]int64{id}) + if err != nil { + return nil, err + } + if rbrs != nil && len(*rbrs) > 0 { + return &((*rbrs)[0]), nil + } + return nil, fmt.Errorf("id %v of report.base.report_irmodulereference not found", id) +} + +// GetReportBaseReportIrmodulereferences gets report.base.report_irmodulereference existing records. +func (c *Client) GetReportBaseReportIrmodulereferences(ids []int64) (*ReportBaseReportIrmodulereferences, error) { + rbrs := &ReportBaseReportIrmodulereferences{} + if err := c.Read(ReportBaseReportIrmodulereferenceModel, ids, nil, rbrs); err != nil { + return nil, err + } + return rbrs, nil +} + +// FindReportBaseReportIrmodulereference finds report.base.report_irmodulereference record by querying it with criteria. +func (c *Client) FindReportBaseReportIrmodulereference(criteria *Criteria) (*ReportBaseReportIrmodulereference, error) { + rbrs := &ReportBaseReportIrmodulereferences{} + if err := c.SearchRead(ReportBaseReportIrmodulereferenceModel, criteria, NewOptions().Limit(1), rbrs); err != nil { + return nil, err + } + if rbrs != nil && len(*rbrs) > 0 { + return &((*rbrs)[0]), nil + } + return nil, fmt.Errorf("no report.base.report_irmodulereference was found with criteria %v", criteria) +} + +// FindReportBaseReportIrmodulereferences finds report.base.report_irmodulereference records by querying it +// and filtering it with criteria and options. +func (c *Client) FindReportBaseReportIrmodulereferences(criteria *Criteria, options *Options) (*ReportBaseReportIrmodulereferences, error) { + rbrs := &ReportBaseReportIrmodulereferences{} + if err := c.SearchRead(ReportBaseReportIrmodulereferenceModel, criteria, options, rbrs); err != nil { + return nil, err + } + return rbrs, nil +} + +// FindReportBaseReportIrmodulereferenceIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindReportBaseReportIrmodulereferenceIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(ReportBaseReportIrmodulereferenceModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindReportBaseReportIrmodulereferenceId finds record id by querying it with criteria. +func (c *Client) FindReportBaseReportIrmodulereferenceId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ReportBaseReportIrmodulereferenceModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no report.base.report_irmodulereference was found with criteria %v and options %v", criteria, options) +} diff --git a/report_hr_holidays_report_holidayssummary.go b/report_hr_holidays_report_holidayssummary.go new file mode 100644 index 00000000..3fe9f6ed --- /dev/null +++ b/report_hr_holidays_report_holidayssummary.go @@ -0,0 +1,114 @@ +package odoo + +import ( + "fmt" +) + +// ReportHrHolidaysReportHolidayssummary represents report.hr_holidays.report_holidayssummary model. +type ReportHrHolidaysReportHolidayssummary struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` +} + +// ReportHrHolidaysReportHolidayssummarys represents array of report.hr_holidays.report_holidayssummary model. +type ReportHrHolidaysReportHolidayssummarys []ReportHrHolidaysReportHolidayssummary + +// ReportHrHolidaysReportHolidayssummaryModel is the odoo model name. +const ReportHrHolidaysReportHolidayssummaryModel = "report.hr_holidays.report_holidayssummary" + +// Many2One convert ReportHrHolidaysReportHolidayssummary to *Many2One. +func (rhr *ReportHrHolidaysReportHolidayssummary) Many2One() *Many2One { + return NewMany2One(rhr.Id.Get(), "") +} + +// CreateReportHrHolidaysReportHolidayssummary creates a new report.hr_holidays.report_holidayssummary model and returns its id. +func (c *Client) CreateReportHrHolidaysReportHolidayssummary(rhr *ReportHrHolidaysReportHolidayssummary) (int64, error) { + return c.Create(ReportHrHolidaysReportHolidayssummaryModel, rhr) +} + +// UpdateReportHrHolidaysReportHolidayssummary updates an existing report.hr_holidays.report_holidayssummary record. +func (c *Client) UpdateReportHrHolidaysReportHolidayssummary(rhr *ReportHrHolidaysReportHolidayssummary) error { + return c.UpdateReportHrHolidaysReportHolidayssummarys([]int64{rhr.Id.Get()}, rhr) +} + +// UpdateReportHrHolidaysReportHolidayssummarys updates existing report.hr_holidays.report_holidayssummary records. +// All records (represented by ids) will be updated by rhr values. +func (c *Client) UpdateReportHrHolidaysReportHolidayssummarys(ids []int64, rhr *ReportHrHolidaysReportHolidayssummary) error { + return c.Update(ReportHrHolidaysReportHolidayssummaryModel, ids, rhr) +} + +// DeleteReportHrHolidaysReportHolidayssummary deletes an existing report.hr_holidays.report_holidayssummary record. +func (c *Client) DeleteReportHrHolidaysReportHolidayssummary(id int64) error { + return c.DeleteReportHrHolidaysReportHolidayssummarys([]int64{id}) +} + +// DeleteReportHrHolidaysReportHolidayssummarys deletes existing report.hr_holidays.report_holidayssummary records. +func (c *Client) DeleteReportHrHolidaysReportHolidayssummarys(ids []int64) error { + return c.Delete(ReportHrHolidaysReportHolidayssummaryModel, ids) +} + +// GetReportHrHolidaysReportHolidayssummary gets report.hr_holidays.report_holidayssummary existing record. +func (c *Client) GetReportHrHolidaysReportHolidayssummary(id int64) (*ReportHrHolidaysReportHolidayssummary, error) { + rhrs, err := c.GetReportHrHolidaysReportHolidayssummarys([]int64{id}) + if err != nil { + return nil, err + } + if rhrs != nil && len(*rhrs) > 0 { + return &((*rhrs)[0]), nil + } + return nil, fmt.Errorf("id %v of report.hr_holidays.report_holidayssummary not found", id) +} + +// GetReportHrHolidaysReportHolidayssummarys gets report.hr_holidays.report_holidayssummary existing records. +func (c *Client) GetReportHrHolidaysReportHolidayssummarys(ids []int64) (*ReportHrHolidaysReportHolidayssummarys, error) { + rhrs := &ReportHrHolidaysReportHolidayssummarys{} + if err := c.Read(ReportHrHolidaysReportHolidayssummaryModel, ids, nil, rhrs); err != nil { + return nil, err + } + return rhrs, nil +} + +// FindReportHrHolidaysReportHolidayssummary finds report.hr_holidays.report_holidayssummary record by querying it with criteria. +func (c *Client) FindReportHrHolidaysReportHolidayssummary(criteria *Criteria) (*ReportHrHolidaysReportHolidayssummary, error) { + rhrs := &ReportHrHolidaysReportHolidayssummarys{} + if err := c.SearchRead(ReportHrHolidaysReportHolidayssummaryModel, criteria, NewOptions().Limit(1), rhrs); err != nil { + return nil, err + } + if rhrs != nil && len(*rhrs) > 0 { + return &((*rhrs)[0]), nil + } + return nil, fmt.Errorf("no report.hr_holidays.report_holidayssummary was found with criteria %v", criteria) +} + +// FindReportHrHolidaysReportHolidayssummarys finds report.hr_holidays.report_holidayssummary records by querying it +// and filtering it with criteria and options. +func (c *Client) FindReportHrHolidaysReportHolidayssummarys(criteria *Criteria, options *Options) (*ReportHrHolidaysReportHolidayssummarys, error) { + rhrs := &ReportHrHolidaysReportHolidayssummarys{} + if err := c.SearchRead(ReportHrHolidaysReportHolidayssummaryModel, criteria, options, rhrs); err != nil { + return nil, err + } + return rhrs, nil +} + +// FindReportHrHolidaysReportHolidayssummaryIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindReportHrHolidaysReportHolidayssummaryIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(ReportHrHolidaysReportHolidayssummaryModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindReportHrHolidaysReportHolidayssummaryId finds record id by querying it with criteria. +func (c *Client) FindReportHrHolidaysReportHolidayssummaryId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ReportHrHolidaysReportHolidayssummaryModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no report.hr_holidays.report_holidayssummary was found with criteria %v and options %v", criteria, options) +} diff --git a/report_paperformat.go b/report_paperformat.go new file mode 100644 index 00000000..00c0f6ca --- /dev/null +++ b/report_paperformat.go @@ -0,0 +1,132 @@ +package odoo + +import ( + "fmt" +) + +// ReportPaperformat represents report.paperformat model. +type ReportPaperformat struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Default *Bool `xmlrpc:"default,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"` + 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) { + return c.Create(ReportPaperformatModel, rp) +} + +// 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) +} + +// 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 + } + if rps != nil && len(*rps) > 0 { + return &((*rps)[0]), nil + } + return nil, fmt.Errorf("id %v of report.paperformat not found", id) +} + +// 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 + } + if rps != nil && len(*rps) > 0 { + return &((*rps)[0]), nil + } + return nil, fmt.Errorf("no report.paperformat was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(ReportPaperformatModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no report.paperformat was found with criteria %v and options %v", criteria, options) +} diff --git a/report_product_report_pricelist.go b/report_product_report_pricelist.go new file mode 100644 index 00000000..e14f6d44 --- /dev/null +++ b/report_product_report_pricelist.go @@ -0,0 +1,114 @@ +package odoo + +import ( + "fmt" +) + +// ReportProductReportPricelist represents report.product.report_pricelist model. +type ReportProductReportPricelist struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` +} + +// ReportProductReportPricelists represents array of report.product.report_pricelist model. +type ReportProductReportPricelists []ReportProductReportPricelist + +// ReportProductReportPricelistModel is the odoo model name. +const ReportProductReportPricelistModel = "report.product.report_pricelist" + +// Many2One convert ReportProductReportPricelist to *Many2One. +func (rpr *ReportProductReportPricelist) Many2One() *Many2One { + return NewMany2One(rpr.Id.Get(), "") +} + +// CreateReportProductReportPricelist creates a new report.product.report_pricelist model and returns its id. +func (c *Client) CreateReportProductReportPricelist(rpr *ReportProductReportPricelist) (int64, error) { + return c.Create(ReportProductReportPricelistModel, rpr) +} + +// UpdateReportProductReportPricelist updates an existing report.product.report_pricelist record. +func (c *Client) UpdateReportProductReportPricelist(rpr *ReportProductReportPricelist) error { + return c.UpdateReportProductReportPricelists([]int64{rpr.Id.Get()}, rpr) +} + +// UpdateReportProductReportPricelists updates existing report.product.report_pricelist records. +// All records (represented by ids) will be updated by rpr values. +func (c *Client) UpdateReportProductReportPricelists(ids []int64, rpr *ReportProductReportPricelist) error { + return c.Update(ReportProductReportPricelistModel, ids, rpr) +} + +// DeleteReportProductReportPricelist deletes an existing report.product.report_pricelist record. +func (c *Client) DeleteReportProductReportPricelist(id int64) error { + return c.DeleteReportProductReportPricelists([]int64{id}) +} + +// DeleteReportProductReportPricelists deletes existing report.product.report_pricelist records. +func (c *Client) DeleteReportProductReportPricelists(ids []int64) error { + return c.Delete(ReportProductReportPricelistModel, ids) +} + +// GetReportProductReportPricelist gets report.product.report_pricelist existing record. +func (c *Client) GetReportProductReportPricelist(id int64) (*ReportProductReportPricelist, error) { + rprs, err := c.GetReportProductReportPricelists([]int64{id}) + if err != nil { + return nil, err + } + if rprs != nil && len(*rprs) > 0 { + return &((*rprs)[0]), nil + } + return nil, fmt.Errorf("id %v of report.product.report_pricelist not found", id) +} + +// GetReportProductReportPricelists gets report.product.report_pricelist existing records. +func (c *Client) GetReportProductReportPricelists(ids []int64) (*ReportProductReportPricelists, error) { + rprs := &ReportProductReportPricelists{} + if err := c.Read(ReportProductReportPricelistModel, ids, nil, rprs); err != nil { + return nil, err + } + return rprs, nil +} + +// FindReportProductReportPricelist finds report.product.report_pricelist record by querying it with criteria. +func (c *Client) FindReportProductReportPricelist(criteria *Criteria) (*ReportProductReportPricelist, error) { + rprs := &ReportProductReportPricelists{} + if err := c.SearchRead(ReportProductReportPricelistModel, criteria, NewOptions().Limit(1), rprs); err != nil { + return nil, err + } + if rprs != nil && len(*rprs) > 0 { + return &((*rprs)[0]), nil + } + return nil, fmt.Errorf("no report.product.report_pricelist was found with criteria %v", criteria) +} + +// FindReportProductReportPricelists finds report.product.report_pricelist records by querying it +// and filtering it with criteria and options. +func (c *Client) FindReportProductReportPricelists(criteria *Criteria, options *Options) (*ReportProductReportPricelists, error) { + rprs := &ReportProductReportPricelists{} + if err := c.SearchRead(ReportProductReportPricelistModel, criteria, options, rprs); err != nil { + return nil, err + } + return rprs, nil +} + +// FindReportProductReportPricelistIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindReportProductReportPricelistIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(ReportProductReportPricelistModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindReportProductReportPricelistId finds record id by querying it with criteria. +func (c *Client) FindReportProductReportPricelistId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ReportProductReportPricelistModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no report.product.report_pricelist was found with criteria %v and options %v", criteria, options) +} diff --git a/report_project_task_user.go b/report_project_task_user.go new file mode 100644 index 00000000..6a1e0c3f --- /dev/null +++ b/report_project_task_user.go @@ -0,0 +1,136 @@ +package odoo + +import ( + "fmt" +) + +// ReportProjectTaskUser represents report.project.task.user model. +type ReportProjectTaskUser struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + DateDeadline *Time `xmlrpc:"date_deadline,omitempty"` + DateEnd *Time `xmlrpc:"date_end,omitempty"` + DateLastStageUpdate *Time `xmlrpc:"date_last_stage_update,omitempty"` + DateStart *Time `xmlrpc:"date_start,omitempty"` + DelayEndingsDays *Float `xmlrpc:"delay_endings_days,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + HoursDelay *Float `xmlrpc:"hours_delay,omitempty"` + HoursEffective *Float `xmlrpc:"hours_effective,omitempty"` + HoursPlanned *Float `xmlrpc:"hours_planned,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Nbr *Int `xmlrpc:"nbr,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + Priority *Selection `xmlrpc:"priority,omitempty"` + Progress *Float `xmlrpc:"progress,omitempty"` + ProjectId *Many2One `xmlrpc:"project_id,omitempty"` + RemainingHours *Float `xmlrpc:"remaining_hours,omitempty"` + StageId *Many2One `xmlrpc:"stage_id,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + TotalHours *Float `xmlrpc:"total_hours,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + WorkingDaysClose *Float `xmlrpc:"working_days_close,omitempty"` + WorkingDaysOpen *Float `xmlrpc:"working_days_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) { + return c.Create(ReportProjectTaskUserModel, rptu) +} + +// 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) +} + +// 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 + } + if rptus != nil && len(*rptus) > 0 { + return &((*rptus)[0]), nil + } + return nil, fmt.Errorf("id %v of report.project.task.user not found", id) +} + +// 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 + } + if rptus != nil && len(*rptus) > 0 { + return &((*rptus)[0]), nil + } + return nil, fmt.Errorf("no report.project.task.user was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(ReportProjectTaskUserModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no report.project.task.user was found with criteria %v and options %v", criteria, options) +} diff --git a/report_sale_report_saleproforma.go b/report_sale_report_saleproforma.go new file mode 100644 index 00000000..cb360553 --- /dev/null +++ b/report_sale_report_saleproforma.go @@ -0,0 +1,114 @@ +package odoo + +import ( + "fmt" +) + +// ReportSaleReportSaleproforma represents report.sale.report_saleproforma model. +type ReportSaleReportSaleproforma struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` +} + +// ReportSaleReportSaleproformas represents array of report.sale.report_saleproforma model. +type ReportSaleReportSaleproformas []ReportSaleReportSaleproforma + +// ReportSaleReportSaleproformaModel is the odoo model name. +const ReportSaleReportSaleproformaModel = "report.sale.report_saleproforma" + +// Many2One convert ReportSaleReportSaleproforma to *Many2One. +func (rsr *ReportSaleReportSaleproforma) Many2One() *Many2One { + return NewMany2One(rsr.Id.Get(), "") +} + +// CreateReportSaleReportSaleproforma creates a new report.sale.report_saleproforma model and returns its id. +func (c *Client) CreateReportSaleReportSaleproforma(rsr *ReportSaleReportSaleproforma) (int64, error) { + return c.Create(ReportSaleReportSaleproformaModel, rsr) +} + +// UpdateReportSaleReportSaleproforma updates an existing report.sale.report_saleproforma record. +func (c *Client) UpdateReportSaleReportSaleproforma(rsr *ReportSaleReportSaleproforma) error { + return c.UpdateReportSaleReportSaleproformas([]int64{rsr.Id.Get()}, rsr) +} + +// UpdateReportSaleReportSaleproformas updates existing report.sale.report_saleproforma records. +// All records (represented by ids) will be updated by rsr values. +func (c *Client) UpdateReportSaleReportSaleproformas(ids []int64, rsr *ReportSaleReportSaleproforma) error { + return c.Update(ReportSaleReportSaleproformaModel, ids, rsr) +} + +// DeleteReportSaleReportSaleproforma deletes an existing report.sale.report_saleproforma record. +func (c *Client) DeleteReportSaleReportSaleproforma(id int64) error { + return c.DeleteReportSaleReportSaleproformas([]int64{id}) +} + +// DeleteReportSaleReportSaleproformas deletes existing report.sale.report_saleproforma records. +func (c *Client) DeleteReportSaleReportSaleproformas(ids []int64) error { + return c.Delete(ReportSaleReportSaleproformaModel, ids) +} + +// GetReportSaleReportSaleproforma gets report.sale.report_saleproforma existing record. +func (c *Client) GetReportSaleReportSaleproforma(id int64) (*ReportSaleReportSaleproforma, error) { + rsrs, err := c.GetReportSaleReportSaleproformas([]int64{id}) + if err != nil { + return nil, err + } + if rsrs != nil && len(*rsrs) > 0 { + return &((*rsrs)[0]), nil + } + return nil, fmt.Errorf("id %v of report.sale.report_saleproforma not found", id) +} + +// GetReportSaleReportSaleproformas gets report.sale.report_saleproforma existing records. +func (c *Client) GetReportSaleReportSaleproformas(ids []int64) (*ReportSaleReportSaleproformas, error) { + rsrs := &ReportSaleReportSaleproformas{} + if err := c.Read(ReportSaleReportSaleproformaModel, ids, nil, rsrs); err != nil { + return nil, err + } + return rsrs, nil +} + +// FindReportSaleReportSaleproforma finds report.sale.report_saleproforma record by querying it with criteria. +func (c *Client) FindReportSaleReportSaleproforma(criteria *Criteria) (*ReportSaleReportSaleproforma, error) { + rsrs := &ReportSaleReportSaleproformas{} + if err := c.SearchRead(ReportSaleReportSaleproformaModel, criteria, NewOptions().Limit(1), rsrs); err != nil { + return nil, err + } + if rsrs != nil && len(*rsrs) > 0 { + return &((*rsrs)[0]), nil + } + return nil, fmt.Errorf("no report.sale.report_saleproforma was found with criteria %v", criteria) +} + +// FindReportSaleReportSaleproformas finds report.sale.report_saleproforma records by querying it +// and filtering it with criteria and options. +func (c *Client) FindReportSaleReportSaleproformas(criteria *Criteria, options *Options) (*ReportSaleReportSaleproformas, error) { + rsrs := &ReportSaleReportSaleproformas{} + if err := c.SearchRead(ReportSaleReportSaleproformaModel, criteria, options, rsrs); err != nil { + return nil, err + } + return rsrs, nil +} + +// FindReportSaleReportSaleproformaIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindReportSaleReportSaleproformaIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(ReportSaleReportSaleproformaModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindReportSaleReportSaleproformaId finds record id by querying it with criteria. +func (c *Client) FindReportSaleReportSaleproformaId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ReportSaleReportSaleproformaModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no report.sale.report_saleproforma was found with criteria %v and options %v", criteria, options) +} diff --git a/report_stock_forecast.go b/report_stock_forecast.go new file mode 100644 index 00000000..5fddb1d2 --- /dev/null +++ b/report_stock_forecast.go @@ -0,0 +1,119 @@ +package odoo + +import ( + "fmt" +) + +// ReportStockForecast represents report.stock.forecast model. +type ReportStockForecast struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CumulativeQuantity *Float `xmlrpc:"cumulative_quantity,omitempty"` + Date *Time `xmlrpc:"date,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + ProductId *Many2One `xmlrpc:"product_id,omitempty"` + ProductTmplId *Many2One `xmlrpc:"product_tmpl_id,omitempty"` + Quantity *Float `xmlrpc:"quantity,omitempty"` +} + +// ReportStockForecasts represents array of report.stock.forecast model. +type ReportStockForecasts []ReportStockForecast + +// ReportStockForecastModel is the odoo model name. +const ReportStockForecastModel = "report.stock.forecast" + +// Many2One convert ReportStockForecast to *Many2One. +func (rsf *ReportStockForecast) Many2One() *Many2One { + return NewMany2One(rsf.Id.Get(), "") +} + +// CreateReportStockForecast creates a new report.stock.forecast model and returns its id. +func (c *Client) CreateReportStockForecast(rsf *ReportStockForecast) (int64, error) { + return c.Create(ReportStockForecastModel, rsf) +} + +// UpdateReportStockForecast updates an existing report.stock.forecast record. +func (c *Client) UpdateReportStockForecast(rsf *ReportStockForecast) error { + return c.UpdateReportStockForecasts([]int64{rsf.Id.Get()}, rsf) +} + +// UpdateReportStockForecasts updates existing report.stock.forecast records. +// All records (represented by ids) will be updated by rsf values. +func (c *Client) UpdateReportStockForecasts(ids []int64, rsf *ReportStockForecast) error { + return c.Update(ReportStockForecastModel, ids, rsf) +} + +// DeleteReportStockForecast deletes an existing report.stock.forecast record. +func (c *Client) DeleteReportStockForecast(id int64) error { + return c.DeleteReportStockForecasts([]int64{id}) +} + +// DeleteReportStockForecasts deletes existing report.stock.forecast records. +func (c *Client) DeleteReportStockForecasts(ids []int64) error { + return c.Delete(ReportStockForecastModel, ids) +} + +// GetReportStockForecast gets report.stock.forecast existing record. +func (c *Client) GetReportStockForecast(id int64) (*ReportStockForecast, error) { + rsfs, err := c.GetReportStockForecasts([]int64{id}) + if err != nil { + return nil, err + } + if rsfs != nil && len(*rsfs) > 0 { + return &((*rsfs)[0]), nil + } + return nil, fmt.Errorf("id %v of report.stock.forecast not found", id) +} + +// GetReportStockForecasts gets report.stock.forecast existing records. +func (c *Client) GetReportStockForecasts(ids []int64) (*ReportStockForecasts, error) { + rsfs := &ReportStockForecasts{} + if err := c.Read(ReportStockForecastModel, ids, nil, rsfs); err != nil { + return nil, err + } + return rsfs, nil +} + +// FindReportStockForecast finds report.stock.forecast record by querying it with criteria. +func (c *Client) FindReportStockForecast(criteria *Criteria) (*ReportStockForecast, error) { + rsfs := &ReportStockForecasts{} + if err := c.SearchRead(ReportStockForecastModel, criteria, NewOptions().Limit(1), rsfs); err != nil { + return nil, err + } + if rsfs != nil && len(*rsfs) > 0 { + return &((*rsfs)[0]), nil + } + return nil, fmt.Errorf("no report.stock.forecast was found with criteria %v", criteria) +} + +// FindReportStockForecasts finds report.stock.forecast records by querying it +// and filtering it with criteria and options. +func (c *Client) FindReportStockForecasts(criteria *Criteria, options *Options) (*ReportStockForecasts, error) { + rsfs := &ReportStockForecasts{} + if err := c.SearchRead(ReportStockForecastModel, criteria, options, rsfs); err != nil { + return nil, err + } + return rsfs, nil +} + +// FindReportStockForecastIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindReportStockForecastIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(ReportStockForecastModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindReportStockForecastId finds record id by querying it with criteria. +func (c *Client) FindReportStockForecastId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ReportStockForecastModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no report.stock.forecast was found with criteria %v and options %v", criteria, options) +} diff --git a/res_bank.go b/res_bank.go new file mode 100644 index 00000000..61b83284 --- /dev/null +++ b/res_bank.go @@ -0,0 +1,129 @@ +package odoo + +import ( + "fmt" +) + +// ResBank represents res.bank model. +type ResBank struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + Active *Bool `xmlrpc:"active,omitempty"` + Bic *String `xmlrpc:"bic,omitempty"` + City *String `xmlrpc:"city,omitempty"` + Country *Many2One `xmlrpc:"country,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) { + return c.Create(ResBankModel, rb) +} + +// 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) +} + +// 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 + } + if rbs != nil && len(*rbs) > 0 { + return &((*rbs)[0]), nil + } + return nil, fmt.Errorf("id %v of res.bank not found", id) +} + +// 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 + } + if rbs != nil && len(*rbs) > 0 { + return &((*rbs)[0]), nil + } + return nil, fmt.Errorf("no res.bank was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(ResBankModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no res.bank was found with criteria %v and options %v", criteria, options) +} diff --git a/res_company.go b/res_company.go index 847d7355..28b8e380 100644 --- a/res_company.go +++ b/res_company.go @@ -6,93 +6,91 @@ import ( // ResCompany represents res.company model. type ResCompany struct { - LastUpdate *Time `xmlrpc:"__last_update,omptempty"` - AccountInInvoiceNote *String `xmlrpc:"account_in_invoice_note,omptempty"` - AccountNo *String `xmlrpc:"account_no,omptempty"` - AccountOpeningDate *Time `xmlrpc:"account_opening_date,omptempty"` - AccountOpeningJournalId *Many2One `xmlrpc:"account_opening_journal_id,omptempty"` - AccountOpeningMoveId *Many2One `xmlrpc:"account_opening_move_id,omptempty"` - AccountOutInvoiceNote *String `xmlrpc:"account_out_invoice_note,omptempty"` - AccountSetupBankDataDone *Bool `xmlrpc:"account_setup_bank_data_done,omptempty"` - AccountSetupBarClosed *Bool `xmlrpc:"account_setup_bar_closed,omptempty"` - AccountSetupCoaDone *Bool `xmlrpc:"account_setup_coa_done,omptempty"` - AccountSetupCompanyDataDone *Bool `xmlrpc:"account_setup_company_data_done,omptempty"` - AccountSetupFyDataDone *Bool `xmlrpc:"account_setup_fy_data_done,omptempty"` - AccountsCodeDigits *Int `xmlrpc:"accounts_code_digits,omptempty"` - AngloSaxonAccounting *Bool `xmlrpc:"anglo_saxon_accounting,omptempty"` - Ape *String `xmlrpc:"ape,omptempty"` - BankAccountCodePrefix *String `xmlrpc:"bank_account_code_prefix,omptempty"` - BankIds *Relation `xmlrpc:"bank_ids,omptempty"` - BankJournalIds *Relation `xmlrpc:"bank_journal_ids,omptempty"` - CashAccountCodePrefix *String `xmlrpc:"cash_account_code_prefix,omptempty"` - ChartTemplateId *Many2One `xmlrpc:"chart_template_id,omptempty"` - ChildIds *Relation `xmlrpc:"child_ids,omptempty"` - City *String `xmlrpc:"city,omptempty"` - CompanyRegistry *String `xmlrpc:"company_registry,omptempty"` - CountryId *Many2One `xmlrpc:"country_id,omptempty"` - CreateDate *Time `xmlrpc:"create_date,omptempty"` - CreateUid *Many2One `xmlrpc:"create_uid,omptempty"` - CurrencyExchangeJournalId *Many2One `xmlrpc:"currency_exchange_journal_id,omptempty"` - CurrencyId *Many2One `xmlrpc:"currency_id,omptempty"` - DisplayName *String `xmlrpc:"display_name,omptempty"` - Email *String `xmlrpc:"email,omptempty"` - ExpectsChartOfAccounts *Bool `xmlrpc:"expects_chart_of_accounts,omptempty"` - ExpenseCurrencyExchangeAccountId *Many2One `xmlrpc:"expense_currency_exchange_account_id,omptempty"` - ExternalReportLayout *Selection `xmlrpc:"external_report_layout,omptempty"` - FiscalyearLastDay *Int `xmlrpc:"fiscalyear_last_day,omptempty"` - FiscalyearLastMonth *Selection `xmlrpc:"fiscalyear_last_month,omptempty"` - FiscalyearLockDate *Time `xmlrpc:"fiscalyear_lock_date,omptempty"` - Id *Int `xmlrpc:"id,omptempty"` - IncomeCurrencyExchangeAccountId *Many2One `xmlrpc:"income_currency_exchange_account_id,omptempty"` - InternalTransitLocationId *Many2One `xmlrpc:"internal_transit_location_id,omptempty"` - LeaveTimesheetProjectId *Many2One `xmlrpc:"leave_timesheet_project_id,omptempty"` - LeaveTimesheetTaskId *Many2One `xmlrpc:"leave_timesheet_task_id,omptempty"` - Logo *String `xmlrpc:"logo,omptempty"` - LogoWeb *String `xmlrpc:"logo_web,omptempty"` - Name *String `xmlrpc:"name,omptempty"` - OverdueMsg *String `xmlrpc:"overdue_msg,omptempty"` - PaperformatId *Many2One `xmlrpc:"paperformat_id,omptempty"` - ParentId *Many2One `xmlrpc:"parent_id,omptempty"` - PartnerId *Many2One `xmlrpc:"partner_id,omptempty"` - PeriodLockDate *Time `xmlrpc:"period_lock_date,omptempty"` - Phone *String `xmlrpc:"phone,omptempty"` - PoDoubleValidation *Selection `xmlrpc:"po_double_validation,omptempty"` - PoDoubleValidationAmount *Float `xmlrpc:"po_double_validation_amount,omptempty"` - PoLead *Float `xmlrpc:"po_lead,omptempty"` - PoLock *Selection `xmlrpc:"po_lock,omptempty"` - ProjectTimeModeId *Many2One `xmlrpc:"project_time_mode_id,omptempty"` - PropagationMinimumDelta *Int `xmlrpc:"propagation_minimum_delta,omptempty"` - PropertyStockAccountInputCategId *Many2One `xmlrpc:"property_stock_account_input_categ_id,omptempty"` - PropertyStockAccountOutputCategId *Many2One `xmlrpc:"property_stock_account_output_categ_id,omptempty"` - PropertyStockValuationAccountId *Many2One `xmlrpc:"property_stock_valuation_account_id,omptempty"` - ReportFooter *String `xmlrpc:"report_footer,omptempty"` - ReportHeader *String `xmlrpc:"report_header,omptempty"` - ResourceCalendarId *Many2One `xmlrpc:"resource_calendar_id,omptempty"` - ResourceCalendarIds *Relation `xmlrpc:"resource_calendar_ids,omptempty"` - SaleNote *String `xmlrpc:"sale_note,omptempty"` - SecurityLead *Float `xmlrpc:"security_lead,omptempty"` - Sequence *Int `xmlrpc:"sequence,omptempty"` - Siret *String `xmlrpc:"siret,omptempty"` - SocialFacebook *String `xmlrpc:"social_facebook,omptempty"` - SocialGithub *String `xmlrpc:"social_github,omptempty"` - SocialGoogleplus *String `xmlrpc:"social_googleplus,omptempty"` - SocialLinkedin *String `xmlrpc:"social_linkedin,omptempty"` - SocialTwitter *String `xmlrpc:"social_twitter,omptempty"` - SocialYoutube *String `xmlrpc:"social_youtube,omptempty"` - StateId *Many2One `xmlrpc:"state_id,omptempty"` - Street *String `xmlrpc:"street,omptempty"` - Street2 *String `xmlrpc:"street2,omptempty"` - TaxCalculationRoundingMethod *Selection `xmlrpc:"tax_calculation_rounding_method,omptempty"` - TaxCashBasisJournalId *Many2One `xmlrpc:"tax_cash_basis_journal_id,omptempty"` - TaxExigibility *Bool `xmlrpc:"tax_exigibility,omptempty"` - TransferAccountId *Many2One `xmlrpc:"transfer_account_id,omptempty"` - UserIds *Relation `xmlrpc:"user_ids,omptempty"` - Vat *String `xmlrpc:"vat,omptempty"` - VatCheckVies *Bool `xmlrpc:"vat_check_vies,omptempty"` - Website *String `xmlrpc:"website,omptempty"` - WriteDate *Time `xmlrpc:"write_date,omptempty"` - WriteUid *Many2One `xmlrpc:"write_uid,omptempty"` - Zip *String `xmlrpc:"zip,omptempty"` + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AccountNo *String `xmlrpc:"account_no,omitempty"` + AccountOpeningDate *Time `xmlrpc:"account_opening_date,omitempty"` + AccountOpeningJournalId *Many2One `xmlrpc:"account_opening_journal_id,omitempty"` + AccountOpeningMoveId *Many2One `xmlrpc:"account_opening_move_id,omitempty"` + AccountSetupBankDataDone *Bool `xmlrpc:"account_setup_bank_data_done,omitempty"` + AccountSetupBarClosed *Bool `xmlrpc:"account_setup_bar_closed,omitempty"` + AccountSetupCoaDone *Bool `xmlrpc:"account_setup_coa_done,omitempty"` + AccountSetupCompanyDataDone *Bool `xmlrpc:"account_setup_company_data_done,omitempty"` + AccountSetupFyDataDone *Bool `xmlrpc:"account_setup_fy_data_done,omitempty"` + AccountsCodeDigits *Int `xmlrpc:"accounts_code_digits,omitempty"` + AngloSaxonAccounting *Bool `xmlrpc:"anglo_saxon_accounting,omitempty"` + Ape *String `xmlrpc:"ape,omitempty"` + BankAccountCodePrefix *String `xmlrpc:"bank_account_code_prefix,omitempty"` + BankIds *Relation `xmlrpc:"bank_ids,omitempty"` + BankJournalIds *Relation `xmlrpc:"bank_journal_ids,omitempty"` + CashAccountCodePrefix *String `xmlrpc:"cash_account_code_prefix,omitempty"` + ChartTemplateId *Many2One `xmlrpc:"chart_template_id,omitempty"` + ChildIds *Relation `xmlrpc:"child_ids,omitempty"` + City *String `xmlrpc:"city,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"` + CurrencyExchangeJournalId *Many2One `xmlrpc:"currency_exchange_journal_id,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Email *String `xmlrpc:"email,omitempty"` + ExpectsChartOfAccounts *Bool `xmlrpc:"expects_chart_of_accounts,omitempty"` + ExpenseCurrencyExchangeAccountId *Many2One `xmlrpc:"expense_currency_exchange_account_id,omitempty"` + ExternalReportLayout *Selection `xmlrpc:"external_report_layout,omitempty"` + FiscalyearLastDay *Int `xmlrpc:"fiscalyear_last_day,omitempty"` + FiscalyearLastMonth *Selection `xmlrpc:"fiscalyear_last_month,omitempty"` + FiscalyearLockDate *Time `xmlrpc:"fiscalyear_lock_date,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IncomeCurrencyExchangeAccountId *Many2One `xmlrpc:"income_currency_exchange_account_id,omitempty"` + InternalTransitLocationId *Many2One `xmlrpc:"internal_transit_location_id,omitempty"` + LeaveTimesheetProjectId *Many2One `xmlrpc:"leave_timesheet_project_id,omitempty"` + LeaveTimesheetTaskId *Many2One `xmlrpc:"leave_timesheet_task_id,omitempty"` + Logo *String `xmlrpc:"logo,omitempty"` + LogoWeb *String `xmlrpc:"logo_web,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + OverdueMsg *String `xmlrpc:"overdue_msg,omitempty"` + PaperformatId *Many2One `xmlrpc:"paperformat_id,omitempty"` + ParentId *Many2One `xmlrpc:"parent_id,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PeriodLockDate *Time `xmlrpc:"period_lock_date,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"` + ProjectTimeModeId *Many2One `xmlrpc:"project_time_mode_id,omitempty"` + PropagationMinimumDelta *Int `xmlrpc:"propagation_minimum_delta,omitempty"` + PropertyStockAccountInputCategId *Many2One `xmlrpc:"property_stock_account_input_categ_id,omitempty"` + PropertyStockAccountOutputCategId *Many2One `xmlrpc:"property_stock_account_output_categ_id,omitempty"` + PropertyStockValuationAccountId *Many2One `xmlrpc:"property_stock_valuation_account_id,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"` + SaleNote *String `xmlrpc:"sale_note,omitempty"` + SecurityLead *Float `xmlrpc:"security_lead,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + Siret *String `xmlrpc:"siret,omitempty"` + SocialFacebook *String `xmlrpc:"social_facebook,omitempty"` + SocialGithub *String `xmlrpc:"social_github,omitempty"` + SocialGoogleplus *String `xmlrpc:"social_googleplus,omitempty"` + SocialLinkedin *String `xmlrpc:"social_linkedin,omitempty"` + SocialTwitter *String `xmlrpc:"social_twitter,omitempty"` + SocialYoutube *String `xmlrpc:"social_youtube,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"` + TransferAccountId *Many2One `xmlrpc:"transfer_account_id,omitempty"` + UserIds *Relation `xmlrpc:"user_ids,omitempty"` + Vat *String `xmlrpc:"vat,omitempty"` + VatCheckVies *Bool `xmlrpc:"vat_check_vies,omitempty"` + Website *String `xmlrpc:"website,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. @@ -162,7 +160,7 @@ func (c *Client) FindResCompany(criteria *Criteria) (*ResCompany, error) { if rcs != nil && len(*rcs) > 0 { return &((*rcs)[0]), nil } - return nil, fmt.Errorf("res.company was not found") + return nil, fmt.Errorf("no res.company was found with criteria %v", criteria) } // FindResCompanys finds res.company records by querying it @@ -194,5 +192,5 @@ func (c *Client) FindResCompanyId(criteria *Criteria, options *Options) (int64, if len(ids) > 0 { return ids[0], nil } - return -1, fmt.Errorf("res.company was not found") + return -1, fmt.Errorf("no res.company was found with criteria %v and options %v", criteria, options) } diff --git a/res_config.go b/res_config.go new file mode 100644 index 00000000..7ab9719a --- /dev/null +++ b/res_config.go @@ -0,0 +1,118 @@ +package odoo + +import ( + "fmt" +) + +// ResConfig represents res.config model. +type ResConfig struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` +} + +// 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) { + return c.Create(ResConfigModel, rc) +} + +// 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) +} + +// 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 + } + if rcs != nil && len(*rcs) > 0 { + return &((*rcs)[0]), nil + } + return nil, fmt.Errorf("id %v of res.config not found", id) +} + +// 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 + } + if rcs != nil && len(*rcs) > 0 { + return &((*rcs)[0]), nil + } + return nil, fmt.Errorf("no res.config was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(ResConfigModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no res.config was found with criteria %v and options %v", criteria, options) +} diff --git a/res_config_installer.go b/res_config_installer.go new file mode 100644 index 00000000..6281589e --- /dev/null +++ b/res_config_installer.go @@ -0,0 +1,118 @@ +package odoo + +import ( + "fmt" +) + +// ResConfigInstaller represents res.config.installer model. +type ResConfigInstaller struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` +} + +// ResConfigInstallers represents array of res.config.installer model. +type ResConfigInstallers []ResConfigInstaller + +// ResConfigInstallerModel is the odoo model name. +const ResConfigInstallerModel = "res.config.installer" + +// Many2One convert ResConfigInstaller to *Many2One. +func (rci *ResConfigInstaller) Many2One() *Many2One { + return NewMany2One(rci.Id.Get(), "") +} + +// CreateResConfigInstaller creates a new res.config.installer model and returns its id. +func (c *Client) CreateResConfigInstaller(rci *ResConfigInstaller) (int64, error) { + return c.Create(ResConfigInstallerModel, rci) +} + +// UpdateResConfigInstaller updates an existing res.config.installer record. +func (c *Client) UpdateResConfigInstaller(rci *ResConfigInstaller) error { + return c.UpdateResConfigInstallers([]int64{rci.Id.Get()}, rci) +} + +// UpdateResConfigInstallers updates existing res.config.installer records. +// All records (represented by ids) will be updated by rci values. +func (c *Client) UpdateResConfigInstallers(ids []int64, rci *ResConfigInstaller) error { + return c.Update(ResConfigInstallerModel, ids, rci) +} + +// DeleteResConfigInstaller deletes an existing res.config.installer record. +func (c *Client) DeleteResConfigInstaller(id int64) error { + return c.DeleteResConfigInstallers([]int64{id}) +} + +// DeleteResConfigInstallers deletes existing res.config.installer records. +func (c *Client) DeleteResConfigInstallers(ids []int64) error { + return c.Delete(ResConfigInstallerModel, ids) +} + +// GetResConfigInstaller gets res.config.installer existing record. +func (c *Client) GetResConfigInstaller(id int64) (*ResConfigInstaller, error) { + rcis, err := c.GetResConfigInstallers([]int64{id}) + if err != nil { + return nil, err + } + if rcis != nil && len(*rcis) > 0 { + return &((*rcis)[0]), nil + } + return nil, fmt.Errorf("id %v of res.config.installer not found", id) +} + +// GetResConfigInstallers gets res.config.installer existing records. +func (c *Client) GetResConfigInstallers(ids []int64) (*ResConfigInstallers, error) { + rcis := &ResConfigInstallers{} + if err := c.Read(ResConfigInstallerModel, ids, nil, rcis); err != nil { + return nil, err + } + return rcis, nil +} + +// FindResConfigInstaller finds res.config.installer record by querying it with criteria. +func (c *Client) FindResConfigInstaller(criteria *Criteria) (*ResConfigInstaller, error) { + rcis := &ResConfigInstallers{} + if err := c.SearchRead(ResConfigInstallerModel, criteria, NewOptions().Limit(1), rcis); err != nil { + return nil, err + } + if rcis != nil && len(*rcis) > 0 { + return &((*rcis)[0]), nil + } + return nil, fmt.Errorf("no res.config.installer was found with criteria %v", criteria) +} + +// FindResConfigInstallers finds res.config.installer records by querying it +// and filtering it with criteria and options. +func (c *Client) FindResConfigInstallers(criteria *Criteria, options *Options) (*ResConfigInstallers, error) { + rcis := &ResConfigInstallers{} + if err := c.SearchRead(ResConfigInstallerModel, criteria, options, rcis); err != nil { + return nil, err + } + return rcis, nil +} + +// FindResConfigInstallerIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindResConfigInstallerIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(ResConfigInstallerModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindResConfigInstallerId finds record id by querying it with criteria. +func (c *Client) FindResConfigInstallerId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ResConfigInstallerModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no res.config.installer was found with criteria %v and options %v", criteria, options) +} diff --git a/res_config_settings.go b/res_config_settings.go new file mode 100644 index 00000000..89eebe3f --- /dev/null +++ b/res_config_settings.go @@ -0,0 +1,272 @@ +package odoo + +import ( + "fmt" +) + +// ResConfigSettings represents res.config.settings model. +type ResConfigSettings struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AccountHideSetupBar *Bool `xmlrpc:"account_hide_setup_bar,omitempty"` + AliasDomain *String `xmlrpc:"alias_domain,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"` + AutoDoneSetting *Bool `xmlrpc:"auto_done_setting,omitempty"` + ChartTemplateId *Many2One `xmlrpc:"chart_template_id,omitempty"` + CodeDigits *Int `xmlrpc:"code_digits,omitempty"` + CompanyCurrencyId *Many2One `xmlrpc:"company_currency_id,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CompanySharePartner *Bool `xmlrpc:"company_share_partner,omitempty"` + CompanyShareProduct *Bool `xmlrpc:"company_share_product,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CrmAliasPrefix *String `xmlrpc:"crm_alias_prefix,omitempty"` + CurrencyExchangeJournalId *Many2One `xmlrpc:"currency_exchange_journal_id,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + DefaultCustomReportFooter *Bool `xmlrpc:"default_custom_report_footer,omitempty"` + DefaultDepositProductId *Many2One `xmlrpc:"default_deposit_product_id,omitempty"` + DefaultExternalEmailServer *Bool `xmlrpc:"default_external_email_server,omitempty"` + DefaultInvoicePolicy *Selection `xmlrpc:"default_invoice_policy,omitempty"` + DefaultPickingPolicy *Selection `xmlrpc:"default_picking_policy,omitempty"` + DefaultPurchaseMethod *Selection `xmlrpc:"default_purchase_method,omitempty"` + DefaultPurchaseTaxId *Many2One `xmlrpc:"default_purchase_tax_id,omitempty"` + DefaultSaleTaxId *Many2One `xmlrpc:"default_sale_tax_id,omitempty"` + DefaultUserRights *Bool `xmlrpc:"default_user_rights,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + ExternalReportLayout *Selection `xmlrpc:"external_report_layout,omitempty"` + FailCounter *Int `xmlrpc:"fail_counter,omitempty"` + GenerateLeadFromAlias *Bool `xmlrpc:"generate_lead_from_alias,omitempty"` + GroupAnalyticAccountForPurchases *Bool `xmlrpc:"group_analytic_account_for_purchases,omitempty"` + GroupAnalyticAccounting *Bool `xmlrpc:"group_analytic_accounting,omitempty"` + GroupCashRounding *Bool `xmlrpc:"group_cash_rounding,omitempty"` + GroupDiscountPerSoLine *Bool `xmlrpc:"group_discount_per_so_line,omitempty"` + GroupDisplayIncoterm *Bool `xmlrpc:"group_display_incoterm,omitempty"` + GroupManageVendorPrice *Bool `xmlrpc:"group_manage_vendor_price,omitempty"` + GroupMassMailingCampaign *Bool `xmlrpc:"group_mass_mailing_campaign,omitempty"` + GroupMultiCompany *Bool `xmlrpc:"group_multi_company,omitempty"` + GroupMultiCurrency *Bool `xmlrpc:"group_multi_currency,omitempty"` + GroupPricelistItem *Bool `xmlrpc:"group_pricelist_item,omitempty"` + GroupProductPricelist *Bool `xmlrpc:"group_product_pricelist,omitempty"` + GroupProductVariant *Bool `xmlrpc:"group_product_variant,omitempty"` + GroupProformaSales *Bool `xmlrpc:"group_proforma_sales,omitempty"` + GroupRouteSoLines *Bool `xmlrpc:"group_route_so_lines,omitempty"` + GroupSaleDeliveryAddress *Bool `xmlrpc:"group_sale_delivery_address,omitempty"` + GroupSaleLayout *Bool `xmlrpc:"group_sale_layout,omitempty"` + GroupSalePricelist *Bool `xmlrpc:"group_sale_pricelist,omitempty"` + GroupShowPriceSubtotal *Bool `xmlrpc:"group_show_price_subtotal,omitempty"` + GroupShowPriceTotal *Bool `xmlrpc:"group_show_price_total,omitempty"` + GroupStockAdvLocation *Bool `xmlrpc:"group_stock_adv_location,omitempty"` + GroupStockMultiLocations *Bool `xmlrpc:"group_stock_multi_locations,omitempty"` + GroupStockMultiWarehouses *Bool `xmlrpc:"group_stock_multi_warehouses,omitempty"` + GroupStockPackaging *Bool `xmlrpc:"group_stock_packaging,omitempty"` + GroupStockProductionLot *Bool `xmlrpc:"group_stock_production_lot,omitempty"` + GroupStockTrackingLot *Bool `xmlrpc:"group_stock_tracking_lot,omitempty"` + GroupStockTrackingOwner *Bool `xmlrpc:"group_stock_tracking_owner,omitempty"` + GroupSubtaskProject *Bool `xmlrpc:"group_subtask_project,omitempty"` + GroupUom *Bool `xmlrpc:"group_uom,omitempty"` + GroupUseLead *Bool `xmlrpc:"group_use_lead,omitempty"` + GroupWarningAccount *Bool `xmlrpc:"group_warning_account,omitempty"` + GroupWarningPurchase *Bool `xmlrpc:"group_warning_purchase,omitempty"` + GroupWarningSale *Bool `xmlrpc:"group_warning_sale,omitempty"` + GroupWarningStock *Bool `xmlrpc:"group_warning_stock,omitempty"` + HasAccountingEntries *Bool `xmlrpc:"has_accounting_entries,omitempty"` + HasChartOfAccounts *Bool `xmlrpc:"has_chart_of_accounts,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsInstalledSale *Bool `xmlrpc:"is_installed_sale,omitempty"` + LeaveTimesheetProjectId *Many2One `xmlrpc:"leave_timesheet_project_id,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"` + ModuleAccountAsset *Bool `xmlrpc:"module_account_asset,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"` + ModuleAccountBatchDeposit *Bool `xmlrpc:"module_account_batch_deposit,omitempty"` + ModuleAccountBudget *Bool `xmlrpc:"module_account_budget,omitempty"` + ModuleAccountDeferredRevenue *Bool `xmlrpc:"module_account_deferred_revenue,omitempty"` + ModuleAccountPayment *Bool `xmlrpc:"module_account_payment,omitempty"` + ModuleAccountPlaid *Bool `xmlrpc:"module_account_plaid,omitempty"` + ModuleAccountReports *Bool `xmlrpc:"module_account_reports,omitempty"` + ModuleAccountReportsFollowup *Bool `xmlrpc:"module_account_reports_followup,omitempty"` + ModuleAccountSepa *Bool `xmlrpc:"module_account_sepa,omitempty"` + ModuleAccountSepaDirectDebit *Bool `xmlrpc:"module_account_sepa_direct_debit,omitempty"` + ModuleAccountTaxcloud *Bool `xmlrpc:"module_account_taxcloud,omitempty"` + ModuleAccountYodlee *Bool `xmlrpc:"module_account_yodlee,omitempty"` + ModuleAuthLdap *Bool `xmlrpc:"module_auth_ldap,omitempty"` + ModuleAuthOauth *Bool `xmlrpc:"module_auth_oauth,omitempty"` + ModuleBaseGengo *Bool `xmlrpc:"module_base_gengo,omitempty"` + ModuleBaseImport *Bool `xmlrpc:"module_base_import,omitempty"` + ModuleCrmPhoneValidation *Bool `xmlrpc:"module_crm_phone_validation,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"` + ModuleDeliveryFedex *Bool `xmlrpc:"module_delivery_fedex,omitempty"` + ModuleDeliveryUps *Bool `xmlrpc:"module_delivery_ups,omitempty"` + ModuleDeliveryUsps *Bool `xmlrpc:"module_delivery_usps,omitempty"` + ModuleGoogleCalendar *Bool `xmlrpc:"module_google_calendar,omitempty"` + ModuleGoogleDrive *Bool `xmlrpc:"module_google_drive,omitempty"` + ModuleGoogleSpreadsheet *Bool `xmlrpc:"module_google_spreadsheet,omitempty"` + ModuleHrOrgChart *Bool `xmlrpc:"module_hr_org_chart,omitempty"` + ModuleHrTimesheet *Bool `xmlrpc:"module_hr_timesheet,omitempty"` + ModuleInterCompanyRules *Bool `xmlrpc:"module_inter_company_rules,omitempty"` + ModuleL10NEuService *Bool `xmlrpc:"module_l10n_eu_service,omitempty"` + ModuleL10NUsCheckPrinting *Bool `xmlrpc:"module_l10n_us_check_printing,omitempty"` + ModulePad *Bool `xmlrpc:"module_pad,omitempty"` + ModulePrintDocsaway *Bool `xmlrpc:"module_print_docsaway,omitempty"` + ModuleProcurementJit *Selection `xmlrpc:"module_procurement_jit,omitempty"` + ModuleProductEmailTemplate *Bool `xmlrpc:"module_product_email_template,omitempty"` + ModuleProductExpiry *Bool `xmlrpc:"module_product_expiry,omitempty"` + ModuleProductMargin *Bool `xmlrpc:"module_product_margin,omitempty"` + ModuleProjectForecast *Bool `xmlrpc:"module_project_forecast,omitempty"` + ModuleProjectTimesheetHolidays *Bool `xmlrpc:"module_project_timesheet_holidays,omitempty"` + ModuleProjectTimesheetSynchro *Bool `xmlrpc:"module_project_timesheet_synchro,omitempty"` + ModulePurchaseRequisition *Bool `xmlrpc:"module_purchase_requisition,omitempty"` + ModuleRatingProject *Bool `xmlrpc:"module_rating_project,omitempty"` + ModuleSaleCoupon *Bool `xmlrpc:"module_sale_coupon,omitempty"` + ModuleSaleMargin *Bool `xmlrpc:"module_sale_margin,omitempty"` + ModuleSaleOrderDates *Bool `xmlrpc:"module_sale_order_dates,omitempty"` + ModuleSalePayment *Bool `xmlrpc:"module_sale_payment,omitempty"` + ModuleSaleTimesheet *Bool `xmlrpc:"module_sale_timesheet,omitempty"` + ModuleStockBarcode *Bool `xmlrpc:"module_stock_barcode,omitempty"` + ModuleStockDropshipping *Bool `xmlrpc:"module_stock_dropshipping,omitempty"` + ModuleStockLandedCosts *Bool `xmlrpc:"module_stock_landed_costs,omitempty"` + ModuleStockPickingBatch *Bool `xmlrpc:"module_stock_picking_batch,omitempty"` + ModuleVoip *Bool `xmlrpc:"module_voip,omitempty"` + ModuleWebClearbit *Bool `xmlrpc:"module_web_clearbit,omitempty"` + ModuleWebsiteQuote *Bool `xmlrpc:"module_website_quote,omitempty"` + ModuleWebsiteSaleDigital *Bool `xmlrpc:"module_website_sale_digital,omitempty"` + MultiSalesPrice *Bool `xmlrpc:"multi_sales_price,omitempty"` + MultiSalesPriceMethod *Selection `xmlrpc:"multi_sales_price_method,omitempty"` + PaperformatId *Many2One `xmlrpc:"paperformat_id,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"` + PortalConfirmation *Bool `xmlrpc:"portal_confirmation,omitempty"` + PortalConfirmationOptions *Selection `xmlrpc:"portal_confirmation_options,omitempty"` + ProjectTimeModeId *Many2One `xmlrpc:"project_time_mode_id,omitempty"` + PropagationMinimumDelta *Int `xmlrpc:"propagation_minimum_delta,omitempty"` + ReportFooter *String `xmlrpc:"report_footer,omitempty"` + ResourceCalendarId *Many2One `xmlrpc:"resource_calendar_id,omitempty"` + SaleNote *String `xmlrpc:"sale_note,omitempty"` + SalePricelistSetting *Selection `xmlrpc:"sale_pricelist_setting,omitempty"` + SaleShowTax *Selection `xmlrpc:"sale_show_tax,omitempty"` + SecurityLead *Float `xmlrpc:"security_lead,omitempty"` + TaxCalculationRoundingMethod *Selection `xmlrpc:"tax_calculation_rounding_method,omitempty"` + TaxCashBasisJournalId *Many2One `xmlrpc:"tax_cash_basis_journal_id,omitempty"` + TaxExigibility *Bool `xmlrpc:"tax_exigibility,omitempty"` + UsePoLead *Bool `xmlrpc:"use_po_lead,omitempty"` + UsePropagationMinimumDelta *Bool `xmlrpc:"use_propagation_minimum_delta,omitempty"` + UseSaleNote *Bool `xmlrpc:"use_sale_note,omitempty"` + UseSecurityLead *Bool `xmlrpc:"use_security_lead,omitempty"` + VatCheckVies *Bool `xmlrpc:"vat_check_vies,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) { + return c.Create(ResConfigSettingsModel, rcs) +} + +// 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) +} + +// 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 + } + if rcss != nil && len(*rcss) > 0 { + return &((*rcss)[0]), nil + } + return nil, fmt.Errorf("id %v of res.config.settings not found", id) +} + +// 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 + } + if rcss != nil && len(*rcss) > 0 { + return &((*rcss)[0]), nil + } + return nil, fmt.Errorf("no res.config.settings was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(ResConfigSettingsModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no res.config.settings was found with criteria %v and options %v", criteria, options) +} diff --git a/res_country.go b/res_country.go new file mode 100644 index 00000000..089989c0 --- /dev/null +++ b/res_country.go @@ -0,0 +1,129 @@ +package odoo + +import ( + "fmt" +) + +// ResCountry represents res.country model. +type ResCountry struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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"` + Image *String `xmlrpc:"image,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + NamePosition *Selection `xmlrpc:"name_position,omitempty"` + PhoneCode *Int `xmlrpc:"phone_code,omitempty"` + StateIds *Relation `xmlrpc:"state_ids,omitempty"` + VatLabel *String `xmlrpc:"vat_label,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,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) { + return c.Create(ResCountryModel, rc) +} + +// 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) +} + +// 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 + } + if rcs != nil && len(*rcs) > 0 { + return &((*rcs)[0]), nil + } + return nil, fmt.Errorf("id %v of res.country not found", id) +} + +// 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 + } + if rcs != nil && len(*rcs) > 0 { + return &((*rcs)[0]), nil + } + return nil, fmt.Errorf("no res.country was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(ResCountryModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no res.country was found with criteria %v and options %v", criteria, options) +} diff --git a/res_country_group.go b/res_country_group.go new file mode 100644 index 00000000..032b0c16 --- /dev/null +++ b/res_country_group.go @@ -0,0 +1,121 @@ +package odoo + +import ( + "fmt" +) + +// ResCountryGroup represents res.country.group model. +type ResCountryGroup struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` + 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) { + return c.Create(ResCountryGroupModel, rcg) +} + +// 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) +} + +// 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 + } + if rcgs != nil && len(*rcgs) > 0 { + return &((*rcgs)[0]), nil + } + return nil, fmt.Errorf("id %v of res.country.group not found", id) +} + +// 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 + } + if rcgs != nil && len(*rcgs) > 0 { + return &((*rcgs)[0]), nil + } + return nil, fmt.Errorf("no res.country.group was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(ResCountryGroupModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no res.country.group was found with criteria %v and options %v", criteria, options) +} diff --git a/res_country_state.go b/res_country_state.go new file mode 100644 index 00000000..a919d6e9 --- /dev/null +++ b/res_country_state.go @@ -0,0 +1,121 @@ +package odoo + +import ( + "fmt" +) + +// ResCountryState represents res.country.state model. +type ResCountryState struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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) { + return c.Create(ResCountryStateModel, rcs) +} + +// 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) +} + +// 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 + } + if rcss != nil && len(*rcss) > 0 { + return &((*rcss)[0]), nil + } + return nil, fmt.Errorf("id %v of res.country.state not found", id) +} + +// 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 + } + if rcss != nil && len(*rcss) > 0 { + return &((*rcss)[0]), nil + } + return nil, fmt.Errorf("no res.country.state was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(ResCountryStateModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no res.country.state was found with criteria %v and options %v", criteria, options) +} diff --git a/res_currency.go b/res_currency.go new file mode 100644 index 00000000..dd8a3a77 --- /dev/null +++ b/res_currency.go @@ -0,0 +1,129 @@ +package odoo + +import ( + "fmt" +) + +// ResCurrency represents res.currency model. +type ResCurrency struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Position *Selection `xmlrpc:"position,omitempty"` + Rate *Float `xmlrpc:"rate,omitempty"` + RateIds *Relation `xmlrpc:"rate_ids,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) { + return c.Create(ResCurrencyModel, rc) +} + +// 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) +} + +// 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 + } + if rcs != nil && len(*rcs) > 0 { + return &((*rcs)[0]), nil + } + return nil, fmt.Errorf("id %v of res.currency not found", id) +} + +// 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 + } + if rcs != nil && len(*rcs) > 0 { + return &((*rcs)[0]), nil + } + return nil, fmt.Errorf("no res.currency was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(ResCurrencyModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no res.currency was found with criteria %v and options %v", criteria, options) +} diff --git a/res_currency_rate.go b/res_currency_rate.go new file mode 100644 index 00000000..46a3c66a --- /dev/null +++ b/res_currency_rate.go @@ -0,0 +1,122 @@ +package odoo + +import ( + "fmt" +) + +// ResCurrencyRate represents res.currency.rate model. +type ResCurrencyRate struct { + LastUpdate *Time `xmlrpc:"__last_update,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 *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) { + return c.Create(ResCurrencyRateModel, rcr) +} + +// 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) +} + +// 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 + } + if rcrs != nil && len(*rcrs) > 0 { + return &((*rcrs)[0]), nil + } + return nil, fmt.Errorf("id %v of res.currency.rate not found", id) +} + +// 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 + } + if rcrs != nil && len(*rcrs) > 0 { + return &((*rcrs)[0]), nil + } + return nil, fmt.Errorf("no res.currency.rate was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(ResCurrencyRateModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no res.currency.rate was found with criteria %v and options %v", criteria, options) +} diff --git a/res_groups.go b/res_groups.go new file mode 100644 index 00000000..e58d6541 --- /dev/null +++ b/res_groups.go @@ -0,0 +1,132 @@ +package odoo + +import ( + "fmt" +) + +// ResGroups represents res.groups model. +type ResGroups struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` + IsPortal *Bool `xmlrpc:"is_portal,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) { + return c.Create(ResGroupsModel, rg) +} + +// 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) +} + +// 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 + } + if rgs != nil && len(*rgs) > 0 { + return &((*rgs)[0]), nil + } + return nil, fmt.Errorf("id %v of res.groups not found", id) +} + +// 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 + } + if rgs != nil && len(*rgs) > 0 { + return &((*rgs)[0]), nil + } + return nil, fmt.Errorf("no res.groups was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(ResGroupsModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no res.groups was found with criteria %v and options %v", criteria, options) +} diff --git a/res_lang.go b/res_lang.go new file mode 100644 index 00000000..0c7f2a00 --- /dev/null +++ b/res_lang.go @@ -0,0 +1,129 @@ +package odoo + +import ( + "fmt" +) + +// ResLang represents res.lang model. +type ResLang struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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"` + Grouping *String `xmlrpc:"grouping,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsoCode *String `xmlrpc:"iso_code,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + ThousandsSep *String `xmlrpc:"thousands_sep,omitempty"` + TimeFormat *String `xmlrpc:"time_format,omitempty"` + Translatable *Bool `xmlrpc:"translatable,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) { + return c.Create(ResLangModel, rl) +} + +// 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) +} + +// 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 + } + if rls != nil && len(*rls) > 0 { + return &((*rls)[0]), nil + } + return nil, fmt.Errorf("id %v of res.lang not found", id) +} + +// 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 + } + if rls != nil && len(*rls) > 0 { + return &((*rls)[0]), nil + } + return nil, fmt.Errorf("no res.lang was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(ResLangModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no res.lang was found with criteria %v and options %v", criteria, options) +} diff --git a/res_partner.go b/res_partner.go index a6e0352f..d38090e4 100644 --- a/res_partner.go +++ b/res_partner.go @@ -6,137 +6,137 @@ import ( // ResPartner represents res.partner model. type ResPartner struct { - LastUpdate *Time `xmlrpc:"__last_update,omptempty"` - Active *Bool `xmlrpc:"active,omptempty"` - ActivityDateDeadline *Time `xmlrpc:"activity_date_deadline,omptempty"` - ActivityIds *Relation `xmlrpc:"activity_ids,omptempty"` - ActivityState *Selection `xmlrpc:"activity_state,omptempty"` - ActivitySummary *String `xmlrpc:"activity_summary,omptempty"` - ActivityTypeId *Many2One `xmlrpc:"activity_type_id,omptempty"` - ActivityUserId *Many2One `xmlrpc:"activity_user_id,omptempty"` - BankAccountCount *Int `xmlrpc:"bank_account_count,omptempty"` - BankIds *Relation `xmlrpc:"bank_ids,omptempty"` - Barcode *String `xmlrpc:"barcode,omptempty"` - CalendarLastNotifAck *Time `xmlrpc:"calendar_last_notif_ack,omptempty"` - CategoryId *Relation `xmlrpc:"category_id,omptempty"` - ChannelIds *Relation `xmlrpc:"channel_ids,omptempty"` - ChildIds *Relation `xmlrpc:"child_ids,omptempty"` - City *String `xmlrpc:"city,omptempty"` - Color *Int `xmlrpc:"color,omptempty"` - Comment *String `xmlrpc:"comment,omptempty"` - CommercialCompanyName *String `xmlrpc:"commercial_company_name,omptempty"` - CommercialPartnerCountryId *Many2One `xmlrpc:"commercial_partner_country_id,omptempty"` - CommercialPartnerId *Many2One `xmlrpc:"commercial_partner_id,omptempty"` - CompanyId *Many2One `xmlrpc:"company_id,omptempty"` - CompanyName *String `xmlrpc:"company_name,omptempty"` - CompanyType *Selection `xmlrpc:"company_type,omptempty"` - ContactAddress *String `xmlrpc:"contact_address,omptempty"` - ContractIds *Relation `xmlrpc:"contract_ids,omptempty"` - ContractsCount *Int `xmlrpc:"contracts_count,omptempty"` - CountryId *Many2One `xmlrpc:"country_id,omptempty"` - CreateDate *Time `xmlrpc:"create_date,omptempty"` - CreateUid *Many2One `xmlrpc:"create_uid,omptempty"` - Credit *Float `xmlrpc:"credit,omptempty"` - CreditLimit *Float `xmlrpc:"credit_limit,omptempty"` - CurrencyId *Many2One `xmlrpc:"currency_id,omptempty"` - Customer *Bool `xmlrpc:"customer,omptempty"` - Date *Time `xmlrpc:"date,omptempty"` - Debit *Float `xmlrpc:"debit,omptempty"` - DebitLimit *Float `xmlrpc:"debit_limit,omptempty"` - DisplayName *String `xmlrpc:"display_name,omptempty"` - Email *String `xmlrpc:"email,omptempty"` - EmailFormatted *String `xmlrpc:"email_formatted,omptempty"` - Employee *Bool `xmlrpc:"employee,omptempty"` - Function *String `xmlrpc:"function,omptempty"` - HasUnreconciledEntries *Bool `xmlrpc:"has_unreconciled_entries,omptempty"` - Id *Int `xmlrpc:"id,omptempty"` - ImStatus *String `xmlrpc:"im_status,omptempty"` - Image *String `xmlrpc:"image,omptempty"` - ImageMedium *String `xmlrpc:"image_medium,omptempty"` - ImageSmall *String `xmlrpc:"image_small,omptempty"` - IndustryId *Many2One `xmlrpc:"industry_id,omptempty"` - InvoiceIds *Relation `xmlrpc:"invoice_ids,omptempty"` - InvoiceWarn *Selection `xmlrpc:"invoice_warn,omptempty"` - InvoiceWarnMsg *String `xmlrpc:"invoice_warn_msg,omptempty"` - IsCompany *Bool `xmlrpc:"is_company,omptempty"` - JournalItemCount *Int `xmlrpc:"journal_item_count,omptempty"` - Lang *Selection `xmlrpc:"lang,omptempty"` - LastTimeEntriesChecked *Time `xmlrpc:"last_time_entries_checked,omptempty"` - MachineCompanyName *String `xmlrpc:"machine_company_name,omptempty"` - MeetingCount *Int `xmlrpc:"meeting_count,omptempty"` - MeetingIds *Relation `xmlrpc:"meeting_ids,omptempty"` - MessageBounce *Int `xmlrpc:"message_bounce,omptempty"` - MessageChannelIds *Relation `xmlrpc:"message_channel_ids,omptempty"` - MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omptempty"` - MessageIds *Relation `xmlrpc:"message_ids,omptempty"` - MessageIsFollower *Bool `xmlrpc:"message_is_follower,omptempty"` - MessageLastPost *Time `xmlrpc:"message_last_post,omptempty"` - MessageNeedaction *Bool `xmlrpc:"message_needaction,omptempty"` - MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omptempty"` - MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omptempty"` - MessageUnread *Bool `xmlrpc:"message_unread,omptempty"` - MessageUnreadCounter *Int `xmlrpc:"message_unread_counter,omptempty"` - Mobile *String `xmlrpc:"mobile,omptempty"` - Name *String `xmlrpc:"name,omptempty"` - OpportunityCount *Int `xmlrpc:"opportunity_count,omptempty"` - OpportunityIds *Relation `xmlrpc:"opportunity_ids,omptempty"` - OptOut *Bool `xmlrpc:"opt_out,omptempty"` - ParentId *Many2One `xmlrpc:"parent_id,omptempty"` - ParentName *String `xmlrpc:"parent_name,omptempty"` - PartnerShare *Bool `xmlrpc:"partner_share,omptempty"` - PaymentTokenCount *Int `xmlrpc:"payment_token_count,omptempty"` - PaymentTokenIds *Relation `xmlrpc:"payment_token_ids,omptempty"` - Phone *String `xmlrpc:"phone,omptempty"` - PickingWarn *Selection `xmlrpc:"picking_warn,omptempty"` - PickingWarnMsg *String `xmlrpc:"picking_warn_msg,omptempty"` - PropertyAccountPayableId *Many2One `xmlrpc:"property_account_payable_id,omptempty"` - PropertyAccountPositionId *Many2One `xmlrpc:"property_account_position_id,omptempty"` - PropertyAccountReceivableId *Many2One `xmlrpc:"property_account_receivable_id,omptempty"` - PropertyAutosalesConfig *Many2One `xmlrpc:"property_autosales_config,omptempty"` - PropertyPaymentTermId *Many2One `xmlrpc:"property_payment_term_id,omptempty"` - PropertyProductPricelist *Many2One `xmlrpc:"property_product_pricelist,omptempty"` - PropertyPurchaseCurrencyId *Many2One `xmlrpc:"property_purchase_currency_id,omptempty"` - PropertyStockCustomer *Many2One `xmlrpc:"property_stock_customer,omptempty"` - PropertyStockSupplier *Many2One `xmlrpc:"property_stock_supplier,omptempty"` - PropertySupplierPaymentTermId *Many2One `xmlrpc:"property_supplier_payment_term_id,omptempty"` - PurchaseOrderCount *Int `xmlrpc:"purchase_order_count,omptempty"` - PurchaseWarn *Selection `xmlrpc:"purchase_warn,omptempty"` - PurchaseWarnMsg *String `xmlrpc:"purchase_warn_msg,omptempty"` - Ref *String `xmlrpc:"ref,omptempty"` - RefCompanyIds *Relation `xmlrpc:"ref_company_ids,omptempty"` - SaleOrderCount *Int `xmlrpc:"sale_order_count,omptempty"` - SaleOrderIds *Relation `xmlrpc:"sale_order_ids,omptempty"` - SaleWarn *Selection `xmlrpc:"sale_warn,omptempty"` - SaleWarnMsg *String `xmlrpc:"sale_warn_msg,omptempty"` - Self *Many2One `xmlrpc:"self,omptempty"` - SignupExpiration *Time `xmlrpc:"signup_expiration,omptempty"` - SignupToken *String `xmlrpc:"signup_token,omptempty"` - SignupType *String `xmlrpc:"signup_type,omptempty"` - SignupUrl *String `xmlrpc:"signup_url,omptempty"` - SignupValid *Bool `xmlrpc:"signup_valid,omptempty"` - Siret *String `xmlrpc:"siret,omptempty"` - StateId *Many2One `xmlrpc:"state_id,omptempty"` - Street *String `xmlrpc:"street,omptempty"` - Street2 *String `xmlrpc:"street2,omptempty"` - Supplier *Bool `xmlrpc:"supplier,omptempty"` - SupplierInvoiceCount *Int `xmlrpc:"supplier_invoice_count,omptempty"` - TaskCount *Int `xmlrpc:"task_count,omptempty"` - TaskIds *Relation `xmlrpc:"task_ids,omptempty"` - TeamId *Many2One `xmlrpc:"team_id,omptempty"` - Title *Many2One `xmlrpc:"title,omptempty"` - TotalInvoiced *Float `xmlrpc:"total_invoiced,omptempty"` - Trust *Selection `xmlrpc:"trust,omptempty"` - Type *Selection `xmlrpc:"type,omptempty"` - Tz *Selection `xmlrpc:"tz,omptempty"` - TzOffset *String `xmlrpc:"tz_offset,omptempty"` - UserId *Many2One `xmlrpc:"user_id,omptempty"` - UserIds *Relation `xmlrpc:"user_ids,omptempty"` - Vat *String `xmlrpc:"vat,omptempty"` - Website *String `xmlrpc:"website,omptempty"` - WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omptempty"` - WriteDate *Time `xmlrpc:"write_date,omptempty"` - WriteUid *Many2One `xmlrpc:"write_uid,omptempty"` - Zip *String `xmlrpc:"zip,omptempty"` + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + Active *Bool `xmlrpc:"active,omitempty"` + ActivityDateDeadline *Time `xmlrpc:"activity_date_deadline,omitempty"` + ActivityIds *Relation `xmlrpc:"activity_ids,omitempty"` + ActivityState *Selection `xmlrpc:"activity_state,omitempty"` + ActivitySummary *String `xmlrpc:"activity_summary,omitempty"` + ActivityTypeId *Many2One `xmlrpc:"activity_type_id,omitempty"` + ActivityUserId *Many2One `xmlrpc:"activity_user_id,omitempty"` + BankAccountCount *Int `xmlrpc:"bank_account_count,omitempty"` + BankIds *Relation `xmlrpc:"bank_ids,omitempty"` + Barcode *String `xmlrpc:"barcode,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"` + CommercialPartnerCountryId *Many2One `xmlrpc:"commercial_partner_country_id,omitempty"` + CommercialPartnerId *Many2One `xmlrpc:"commercial_partner_id,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CompanyName *String `xmlrpc:"company_name,omitempty"` + CompanyType *Selection `xmlrpc:"company_type,omitempty"` + ContactAddress *String `xmlrpc:"contact_address,omitempty"` + ContractIds *Relation `xmlrpc:"contract_ids,omitempty"` + ContractsCount *Int `xmlrpc:"contracts_count,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"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + Customer *Bool `xmlrpc:"customer,omitempty"` + Date *Time `xmlrpc:"date,omitempty"` + Debit *Float `xmlrpc:"debit,omitempty"` + DebitLimit *Float `xmlrpc:"debit_limit,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Email *String `xmlrpc:"email,omitempty"` + EmailFormatted *String `xmlrpc:"email_formatted,omitempty"` + Employee *Bool `xmlrpc:"employee,omitempty"` + Function *String `xmlrpc:"function,omitempty"` + HasUnreconciledEntries *Bool `xmlrpc:"has_unreconciled_entries,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + ImStatus *String `xmlrpc:"im_status,omitempty"` + Image *String `xmlrpc:"image,omitempty"` + ImageMedium *String `xmlrpc:"image_medium,omitempty"` + ImageSmall *String `xmlrpc:"image_small,omitempty"` + IndustryId *Many2One `xmlrpc:"industry_id,omitempty"` + InvoiceIds *Relation `xmlrpc:"invoice_ids,omitempty"` + InvoiceWarn *Selection `xmlrpc:"invoice_warn,omitempty"` + InvoiceWarnMsg *String `xmlrpc:"invoice_warn_msg,omitempty"` + IsCompany *Bool `xmlrpc:"is_company,omitempty"` + JournalItemCount *Int `xmlrpc:"journal_item_count,omitempty"` + Lang *Selection `xmlrpc:"lang,omitempty"` + LastTimeEntriesChecked *Time `xmlrpc:"last_time_entries_checked,omitempty"` + MachineCompanyName *String `xmlrpc:"machine_company_name,omitempty"` + MeetingCount *Int `xmlrpc:"meeting_count,omitempty"` + MeetingIds *Relation `xmlrpc:"meeting_ids,omitempty"` + MessageBounce *Int `xmlrpc:"message_bounce,omitempty"` + MessageChannelIds *Relation `xmlrpc:"message_channel_ids,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageLastPost *Time `xmlrpc:"message_last_post,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MessageUnread *Bool `xmlrpc:"message_unread,omitempty"` + MessageUnreadCounter *Int `xmlrpc:"message_unread_counter,omitempty"` + Mobile *String `xmlrpc:"mobile,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + OpportunityCount *Int `xmlrpc:"opportunity_count,omitempty"` + OpportunityIds *Relation `xmlrpc:"opportunity_ids,omitempty"` + OptOut *Bool `xmlrpc:"opt_out,omitempty"` + ParentId *Many2One `xmlrpc:"parent_id,omitempty"` + ParentName *String `xmlrpc:"parent_name,omitempty"` + PartnerShare *Bool `xmlrpc:"partner_share,omitempty"` + PaymentTokenCount *Int `xmlrpc:"payment_token_count,omitempty"` + PaymentTokenIds *Relation `xmlrpc:"payment_token_ids,omitempty"` + Phone *String `xmlrpc:"phone,omitempty"` + PickingWarn *Selection `xmlrpc:"picking_warn,omitempty"` + PickingWarnMsg *String `xmlrpc:"picking_warn_msg,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"` + PropertyAutosalesConfig *Many2One `xmlrpc:"property_autosales_config,omitempty"` + PropertyPaymentTermId *Many2One `xmlrpc:"property_payment_term_id,omitempty"` + PropertyProductPricelist *Many2One `xmlrpc:"property_product_pricelist,omitempty"` + PropertyPurchaseCurrencyId *Many2One `xmlrpc:"property_purchase_currency_id,omitempty"` + PropertyStockCustomer *Many2One `xmlrpc:"property_stock_customer,omitempty"` + PropertyStockSupplier *Many2One `xmlrpc:"property_stock_supplier,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"` + Ref *String `xmlrpc:"ref,omitempty"` + RefCompanyIds *Relation `xmlrpc:"ref_company_ids,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"` + Self *Many2One `xmlrpc:"self,omitempty"` + SignupExpiration *Time `xmlrpc:"signup_expiration,omitempty"` + SignupToken *String `xmlrpc:"signup_token,omitempty"` + SignupType *String `xmlrpc:"signup_type,omitempty"` + SignupUrl *String `xmlrpc:"signup_url,omitempty"` + SignupValid *Bool `xmlrpc:"signup_valid,omitempty"` + Siret *String `xmlrpc:"siret,omitempty"` + StateId *Many2One `xmlrpc:"state_id,omitempty"` + Street *String `xmlrpc:"street,omitempty"` + Street2 *String `xmlrpc:"street2,omitempty"` + Supplier *Bool `xmlrpc:"supplier,omitempty"` + SupplierInvoiceCount *Int `xmlrpc:"supplier_invoice_count,omitempty"` + TaskCount *Int `xmlrpc:"task_count,omitempty"` + TaskIds *Relation `xmlrpc:"task_ids,omitempty"` + TeamId *Many2One `xmlrpc:"team_id,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"` + 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. @@ -206,7 +206,7 @@ func (c *Client) FindResPartner(criteria *Criteria) (*ResPartner, error) { if rps != nil && len(*rps) > 0 { return &((*rps)[0]), nil } - return nil, fmt.Errorf("res.partner was not found") + return nil, fmt.Errorf("no res.partner was found with criteria %v", criteria) } // FindResPartners finds res.partner records by querying it @@ -238,5 +238,5 @@ func (c *Client) FindResPartnerId(criteria *Criteria, options *Options) (int64, if len(ids) > 0 { return ids[0], nil } - return -1, fmt.Errorf("res.partner was not found") + return -1, fmt.Errorf("no res.partner was found with criteria %v and options %v", criteria, options) } diff --git a/res_partner_bank.go b/res_partner_bank.go new file mode 100644 index 00000000..58e56232 --- /dev/null +++ b/res_partner_bank.go @@ -0,0 +1,129 @@ +package odoo + +import ( + "fmt" +) + +// ResPartnerBank represents res.partner.bank model. +type ResPartnerBank struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AccNumber *String `xmlrpc:"acc_number,omitempty"` + AccType *String `xmlrpc:"acc_type,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"` + 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"` + JournalId *Relation `xmlrpc:"journal_id,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + SanitizedAccNumber *String `xmlrpc:"sanitized_acc_number,omitempty"` + Sequence *Int `xmlrpc:"sequence,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) { + return c.Create(ResPartnerBankModel, rpb) +} + +// 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) +} + +// 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 + } + if rpbs != nil && len(*rpbs) > 0 { + return &((*rpbs)[0]), nil + } + return nil, fmt.Errorf("id %v of res.partner.bank not found", id) +} + +// 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 + } + if rpbs != nil && len(*rpbs) > 0 { + return &((*rpbs)[0]), nil + } + return nil, fmt.Errorf("no res.partner.bank was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(ResPartnerBankModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no res.partner.bank was found with criteria %v and options %v", criteria, options) +} diff --git a/res_partner_category.go b/res_partner_category.go index d70c76e4..3b60b7c1 100644 --- a/res_partner_category.go +++ b/res_partner_category.go @@ -6,21 +6,21 @@ import ( // ResPartnerCategory represents res.partner.category model. type ResPartnerCategory struct { - LastUpdate *Time `xmlrpc:"__last_update,omptempty"` - Active *Bool `xmlrpc:"active,omptempty"` - ChildIds *Relation `xmlrpc:"child_ids,omptempty"` - Color *Int `xmlrpc:"color,omptempty"` - CreateDate *Time `xmlrpc:"create_date,omptempty"` - CreateUid *Many2One `xmlrpc:"create_uid,omptempty"` - DisplayName *String `xmlrpc:"display_name,omptempty"` - Id *Int `xmlrpc:"id,omptempty"` - Name *String `xmlrpc:"name,omptempty"` - ParentId *Many2One `xmlrpc:"parent_id,omptempty"` - ParentLeft *Int `xmlrpc:"parent_left,omptempty"` - ParentRight *Int `xmlrpc:"parent_right,omptempty"` - PartnerIds *Relation `xmlrpc:"partner_ids,omptempty"` - WriteDate *Time `xmlrpc:"write_date,omptempty"` - WriteUid *Many2One `xmlrpc:"write_uid,omptempty"` + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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"` + ParentLeft *Int `xmlrpc:"parent_left,omitempty"` + ParentRight *Int `xmlrpc:"parent_right,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. @@ -90,7 +90,7 @@ func (c *Client) FindResPartnerCategory(criteria *Criteria) (*ResPartnerCategory if rpcs != nil && len(*rpcs) > 0 { return &((*rpcs)[0]), nil } - return nil, fmt.Errorf("res.partner.category was not found") + return nil, fmt.Errorf("no res.partner.category was found with criteria %v", criteria) } // FindResPartnerCategorys finds res.partner.category records by querying it @@ -122,5 +122,5 @@ func (c *Client) FindResPartnerCategoryId(criteria *Criteria, options *Options) if len(ids) > 0 { return ids[0], nil } - return -1, fmt.Errorf("res.partner.category was not found") + return -1, fmt.Errorf("no res.partner.category was found with criteria %v and options %v", criteria, options) } diff --git a/res_partner_industry.go b/res_partner_industry.go new file mode 100644 index 00000000..c51ea6ed --- /dev/null +++ b/res_partner_industry.go @@ -0,0 +1,121 @@ +package odoo + +import ( + "fmt" +) + +// ResPartnerIndustry represents res.partner.industry model. +type ResPartnerIndustry struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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) { + return c.Create(ResPartnerIndustryModel, rpi) +} + +// 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) +} + +// 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 + } + if rpis != nil && len(*rpis) > 0 { + return &((*rpis)[0]), nil + } + return nil, fmt.Errorf("id %v of res.partner.industry not found", id) +} + +// 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 + } + if rpis != nil && len(*rpis) > 0 { + return &((*rpis)[0]), nil + } + return nil, fmt.Errorf("no res.partner.industry was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(ResPartnerIndustryModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no res.partner.industry was found with criteria %v and options %v", criteria, options) +} diff --git a/res_partner_title.go b/res_partner_title.go new file mode 100644 index 00000000..9a9ae6f1 --- /dev/null +++ b/res_partner_title.go @@ -0,0 +1,120 @@ +package odoo + +import ( + "fmt" +) + +// ResPartnerTitle represents res.partner.title model. +type ResPartnerTitle struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` + 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) { + return c.Create(ResPartnerTitleModel, rpt) +} + +// 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) +} + +// 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 + } + if rpts != nil && len(*rpts) > 0 { + return &((*rpts)[0]), nil + } + return nil, fmt.Errorf("id %v of res.partner.title not found", id) +} + +// 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 + } + if rpts != nil && len(*rpts) > 0 { + return &((*rpts)[0]), nil + } + return nil, fmt.Errorf("no res.partner.title was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(ResPartnerTitleModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no res.partner.title was found with criteria %v and options %v", criteria, options) +} diff --git a/res_request_link.go b/res_request_link.go new file mode 100644 index 00000000..ede4bbe0 --- /dev/null +++ b/res_request_link.go @@ -0,0 +1,121 @@ +package odoo + +import ( + "fmt" +) + +// ResRequestLink represents res.request.link model. +type ResRequestLink struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` + Object *String `xmlrpc:"object,omitempty"` + Priority *Int `xmlrpc:"priority,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ResRequestLinks represents array of res.request.link model. +type ResRequestLinks []ResRequestLink + +// ResRequestLinkModel is the odoo model name. +const ResRequestLinkModel = "res.request.link" + +// Many2One convert ResRequestLink to *Many2One. +func (rrl *ResRequestLink) Many2One() *Many2One { + return NewMany2One(rrl.Id.Get(), "") +} + +// CreateResRequestLink creates a new res.request.link model and returns its id. +func (c *Client) CreateResRequestLink(rrl *ResRequestLink) (int64, error) { + return c.Create(ResRequestLinkModel, rrl) +} + +// UpdateResRequestLink updates an existing res.request.link record. +func (c *Client) UpdateResRequestLink(rrl *ResRequestLink) error { + return c.UpdateResRequestLinks([]int64{rrl.Id.Get()}, rrl) +} + +// UpdateResRequestLinks updates existing res.request.link records. +// All records (represented by ids) will be updated by rrl values. +func (c *Client) UpdateResRequestLinks(ids []int64, rrl *ResRequestLink) error { + return c.Update(ResRequestLinkModel, ids, rrl) +} + +// DeleteResRequestLink deletes an existing res.request.link record. +func (c *Client) DeleteResRequestLink(id int64) error { + return c.DeleteResRequestLinks([]int64{id}) +} + +// DeleteResRequestLinks deletes existing res.request.link records. +func (c *Client) DeleteResRequestLinks(ids []int64) error { + return c.Delete(ResRequestLinkModel, ids) +} + +// GetResRequestLink gets res.request.link existing record. +func (c *Client) GetResRequestLink(id int64) (*ResRequestLink, error) { + rrls, err := c.GetResRequestLinks([]int64{id}) + if err != nil { + return nil, err + } + if rrls != nil && len(*rrls) > 0 { + return &((*rrls)[0]), nil + } + return nil, fmt.Errorf("id %v of res.request.link not found", id) +} + +// GetResRequestLinks gets res.request.link existing records. +func (c *Client) GetResRequestLinks(ids []int64) (*ResRequestLinks, error) { + rrls := &ResRequestLinks{} + if err := c.Read(ResRequestLinkModel, ids, nil, rrls); err != nil { + return nil, err + } + return rrls, nil +} + +// FindResRequestLink finds res.request.link record by querying it with criteria. +func (c *Client) FindResRequestLink(criteria *Criteria) (*ResRequestLink, error) { + rrls := &ResRequestLinks{} + if err := c.SearchRead(ResRequestLinkModel, criteria, NewOptions().Limit(1), rrls); err != nil { + return nil, err + } + if rrls != nil && len(*rrls) > 0 { + return &((*rrls)[0]), nil + } + return nil, fmt.Errorf("no res.request.link was found with criteria %v", criteria) +} + +// FindResRequestLinks finds res.request.link records by querying it +// and filtering it with criteria and options. +func (c *Client) FindResRequestLinks(criteria *Criteria, options *Options) (*ResRequestLinks, error) { + rrls := &ResRequestLinks{} + if err := c.SearchRead(ResRequestLinkModel, criteria, options, rrls); err != nil { + return nil, err + } + return rrls, nil +} + +// FindResRequestLinkIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindResRequestLinkIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(ResRequestLinkModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindResRequestLinkId finds record id by querying it with criteria. +func (c *Client) FindResRequestLinkId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ResRequestLinkModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no res.request.link was found with criteria %v and options %v", criteria, options) +} diff --git a/res_users.go b/res_users.go index fcbaea4d..df0d5dfc 100644 --- a/res_users.go +++ b/res_users.go @@ -6,163 +6,163 @@ import ( // ResUsers represents res.users model. type ResUsers struct { - LastUpdate *Time `xmlrpc:"__last_update,omptempty"` - ActionId *Many2One `xmlrpc:"action_id,omptempty"` - Active *Bool `xmlrpc:"active,omptempty"` - ActivityDateDeadline *Time `xmlrpc:"activity_date_deadline,omptempty"` - ActivityIds *Relation `xmlrpc:"activity_ids,omptempty"` - ActivityState *Selection `xmlrpc:"activity_state,omptempty"` - ActivitySummary *String `xmlrpc:"activity_summary,omptempty"` - ActivityTypeId *Many2One `xmlrpc:"activity_type_id,omptempty"` - ActivityUserId *Many2One `xmlrpc:"activity_user_id,omptempty"` - AliasContact *Selection `xmlrpc:"alias_contact,omptempty"` - AliasId *Many2One `xmlrpc:"alias_id,omptempty"` - BankAccountCount *Int `xmlrpc:"bank_account_count,omptempty"` - BankIds *Relation `xmlrpc:"bank_ids,omptempty"` - Barcode *String `xmlrpc:"barcode,omptempty"` - CalendarLastNotifAck *Time `xmlrpc:"calendar_last_notif_ack,omptempty"` - CategoryId *Relation `xmlrpc:"category_id,omptempty"` - ChannelIds *Relation `xmlrpc:"channel_ids,omptempty"` - ChildIds *Relation `xmlrpc:"child_ids,omptempty"` - City *String `xmlrpc:"city,omptempty"` - Color *Int `xmlrpc:"color,omptempty"` - Comment *String `xmlrpc:"comment,omptempty"` - CommercialCompanyName *String `xmlrpc:"commercial_company_name,omptempty"` - CommercialPartnerCountryId *Many2One `xmlrpc:"commercial_partner_country_id,omptempty"` - CommercialPartnerId *Many2One `xmlrpc:"commercial_partner_id,omptempty"` - CompaniesCount *Int `xmlrpc:"companies_count,omptempty"` - CompanyId *Many2One `xmlrpc:"company_id,omptempty"` - CompanyIds *Relation `xmlrpc:"company_ids,omptempty"` - CompanyName *String `xmlrpc:"company_name,omptempty"` - CompanyType *Selection `xmlrpc:"company_type,omptempty"` - ContactAddress *String `xmlrpc:"contact_address,omptempty"` - ContractIds *Relation `xmlrpc:"contract_ids,omptempty"` - ContractsCount *Int `xmlrpc:"contracts_count,omptempty"` - CountryId *Many2One `xmlrpc:"country_id,omptempty"` - CreateDate *Time `xmlrpc:"create_date,omptempty"` - CreateUid *Many2One `xmlrpc:"create_uid,omptempty"` - Credit *Float `xmlrpc:"credit,omptempty"` - CreditLimit *Float `xmlrpc:"credit_limit,omptempty"` - CurrencyId *Many2One `xmlrpc:"currency_id,omptempty"` - Customer *Bool `xmlrpc:"customer,omptempty"` - Date *Time `xmlrpc:"date,omptempty"` - Debit *Float `xmlrpc:"debit,omptempty"` - DebitLimit *Float `xmlrpc:"debit_limit,omptempty"` - DisplayName *String `xmlrpc:"display_name,omptempty"` - Email *String `xmlrpc:"email,omptempty"` - EmailFormatted *String `xmlrpc:"email_formatted,omptempty"` - Employee *Bool `xmlrpc:"employee,omptempty"` - EmployeeIds *Relation `xmlrpc:"employee_ids,omptempty"` - Function *String `xmlrpc:"function,omptempty"` - GroupsId *Relation `xmlrpc:"groups_id,omptempty"` - HasUnreconciledEntries *Bool `xmlrpc:"has_unreconciled_entries,omptempty"` - Id *Int `xmlrpc:"id,omptempty"` - ImStatus *String `xmlrpc:"im_status,omptempty"` - Image *String `xmlrpc:"image,omptempty"` - ImageMedium *String `xmlrpc:"image_medium,omptempty"` - ImageSmall *String `xmlrpc:"image_small,omptempty"` - IndustryId *Many2One `xmlrpc:"industry_id,omptempty"` - InvoiceIds *Relation `xmlrpc:"invoice_ids,omptempty"` - InvoiceWarn *Selection `xmlrpc:"invoice_warn,omptempty"` - InvoiceWarnMsg *String `xmlrpc:"invoice_warn_msg,omptempty"` - IsCompany *Bool `xmlrpc:"is_company,omptempty"` - JournalItemCount *Int `xmlrpc:"journal_item_count,omptempty"` - Lang *Selection `xmlrpc:"lang,omptempty"` - LastTimeEntriesChecked *Time `xmlrpc:"last_time_entries_checked,omptempty"` - LogIds *Relation `xmlrpc:"log_ids,omptempty"` - Login *String `xmlrpc:"login,omptempty"` - LoginDate *Time `xmlrpc:"login_date,omptempty"` - MachineCompanyName *String `xmlrpc:"machine_company_name,omptempty"` - MachineUserEmail *String `xmlrpc:"machine_user_email,omptempty"` - MachineUserLogin *String `xmlrpc:"machine_user_login,omptempty"` - MeetingCount *Int `xmlrpc:"meeting_count,omptempty"` - MeetingIds *Relation `xmlrpc:"meeting_ids,omptempty"` - MessageBounce *Int `xmlrpc:"message_bounce,omptempty"` - MessageChannelIds *Relation `xmlrpc:"message_channel_ids,omptempty"` - MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omptempty"` - MessageIds *Relation `xmlrpc:"message_ids,omptempty"` - MessageIsFollower *Bool `xmlrpc:"message_is_follower,omptempty"` - MessageLastPost *Time `xmlrpc:"message_last_post,omptempty"` - MessageNeedaction *Bool `xmlrpc:"message_needaction,omptempty"` - MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omptempty"` - MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omptempty"` - MessageUnread *Bool `xmlrpc:"message_unread,omptempty"` - MessageUnreadCounter *Int `xmlrpc:"message_unread_counter,omptempty"` - Mobile *String `xmlrpc:"mobile,omptempty"` - Name *String `xmlrpc:"name,omptempty"` - NewPassword *String `xmlrpc:"new_password,omptempty"` - NotificationType *Selection `xmlrpc:"notification_type,omptempty"` - OpportunityCount *Int `xmlrpc:"opportunity_count,omptempty"` - OpportunityIds *Relation `xmlrpc:"opportunity_ids,omptempty"` - OptOut *Bool `xmlrpc:"opt_out,omptempty"` - ParentId *Many2One `xmlrpc:"parent_id,omptempty"` - ParentName *String `xmlrpc:"parent_name,omptempty"` - PartnerId *Many2One `xmlrpc:"partner_id,omptempty"` - PartnerShare *Bool `xmlrpc:"partner_share,omptempty"` - Password *String `xmlrpc:"password,omptempty"` - PasswordCrypt *String `xmlrpc:"password_crypt,omptempty"` - PaymentTokenCount *Int `xmlrpc:"payment_token_count,omptempty"` - PaymentTokenIds *Relation `xmlrpc:"payment_token_ids,omptempty"` - Phone *String `xmlrpc:"phone,omptempty"` - PickingWarn *Selection `xmlrpc:"picking_warn,omptempty"` - PickingWarnMsg *String `xmlrpc:"picking_warn_msg,omptempty"` - PropertyAccountPayableId *Many2One `xmlrpc:"property_account_payable_id,omptempty"` - PropertyAccountPositionId *Many2One `xmlrpc:"property_account_position_id,omptempty"` - PropertyAccountReceivableId *Many2One `xmlrpc:"property_account_receivable_id,omptempty"` - PropertyAutosalesConfig *Many2One `xmlrpc:"property_autosales_config,omptempty"` - PropertyPaymentTermId *Many2One `xmlrpc:"property_payment_term_id,omptempty"` - PropertyProductPricelist *Many2One `xmlrpc:"property_product_pricelist,omptempty"` - PropertyPurchaseCurrencyId *Many2One `xmlrpc:"property_purchase_currency_id,omptempty"` - PropertyStockCustomer *Many2One `xmlrpc:"property_stock_customer,omptempty"` - PropertyStockSupplier *Many2One `xmlrpc:"property_stock_supplier,omptempty"` - PropertySupplierPaymentTermId *Many2One `xmlrpc:"property_supplier_payment_term_id,omptempty"` - PurchaseOrderCount *Int `xmlrpc:"purchase_order_count,omptempty"` - PurchaseWarn *Selection `xmlrpc:"purchase_warn,omptempty"` - PurchaseWarnMsg *String `xmlrpc:"purchase_warn_msg,omptempty"` - Ref *String `xmlrpc:"ref,omptempty"` - RefCompanyIds *Relation `xmlrpc:"ref_company_ids,omptempty"` - ResourceCalendarId *Many2One `xmlrpc:"resource_calendar_id,omptempty"` - ResourceIds *Relation `xmlrpc:"resource_ids,omptempty"` - SaleOrderCount *Int `xmlrpc:"sale_order_count,omptempty"` - SaleOrderIds *Relation `xmlrpc:"sale_order_ids,omptempty"` - SaleTeamId *Many2One `xmlrpc:"sale_team_id,omptempty"` - SaleWarn *Selection `xmlrpc:"sale_warn,omptempty"` - SaleWarnMsg *String `xmlrpc:"sale_warn_msg,omptempty"` - Self *Many2One `xmlrpc:"self,omptempty"` - Share *Bool `xmlrpc:"share,omptempty"` - Signature *String `xmlrpc:"signature,omptempty"` - SignupExpiration *Time `xmlrpc:"signup_expiration,omptempty"` - SignupToken *String `xmlrpc:"signup_token,omptempty"` - SignupType *String `xmlrpc:"signup_type,omptempty"` - SignupUrl *String `xmlrpc:"signup_url,omptempty"` - SignupValid *Bool `xmlrpc:"signup_valid,omptempty"` - Siret *String `xmlrpc:"siret,omptempty"` - State *Selection `xmlrpc:"state,omptempty"` - StateId *Many2One `xmlrpc:"state_id,omptempty"` - Street *String `xmlrpc:"street,omptempty"` - Street2 *String `xmlrpc:"street2,omptempty"` - Supplier *Bool `xmlrpc:"supplier,omptempty"` - SupplierInvoiceCount *Int `xmlrpc:"supplier_invoice_count,omptempty"` - TargetSalesDone *Int `xmlrpc:"target_sales_done,omptempty"` - TargetSalesInvoiced *Int `xmlrpc:"target_sales_invoiced,omptempty"` - TargetSalesWon *Int `xmlrpc:"target_sales_won,omptempty"` - TaskCount *Int `xmlrpc:"task_count,omptempty"` - TaskIds *Relation `xmlrpc:"task_ids,omptempty"` - TeamId *Many2One `xmlrpc:"team_id,omptempty"` - Title *Many2One `xmlrpc:"title,omptempty"` - TotalInvoiced *Float `xmlrpc:"total_invoiced,omptempty"` - Trust *Selection `xmlrpc:"trust,omptempty"` - Type *Selection `xmlrpc:"type,omptempty"` - Tz *Selection `xmlrpc:"tz,omptempty"` - TzOffset *String `xmlrpc:"tz_offset,omptempty"` - UserId *Many2One `xmlrpc:"user_id,omptempty"` - UserIds *Relation `xmlrpc:"user_ids,omptempty"` - Vat *String `xmlrpc:"vat,omptempty"` - Website *String `xmlrpc:"website,omptempty"` - WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omptempty"` - WriteDate *Time `xmlrpc:"write_date,omptempty"` - WriteUid *Many2One `xmlrpc:"write_uid,omptempty"` - Zip *String `xmlrpc:"zip,omptempty"` + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + ActionId *Many2One `xmlrpc:"action_id,omitempty"` + Active *Bool `xmlrpc:"active,omitempty"` + ActivityDateDeadline *Time `xmlrpc:"activity_date_deadline,omitempty"` + ActivityIds *Relation `xmlrpc:"activity_ids,omitempty"` + ActivityState *Selection `xmlrpc:"activity_state,omitempty"` + ActivitySummary *String `xmlrpc:"activity_summary,omitempty"` + ActivityTypeId *Many2One `xmlrpc:"activity_type_id,omitempty"` + ActivityUserId *Many2One `xmlrpc:"activity_user_id,omitempty"` + AliasContact *Selection `xmlrpc:"alias_contact,omitempty"` + AliasId *Many2One `xmlrpc:"alias_id,omitempty"` + BankAccountCount *Int `xmlrpc:"bank_account_count,omitempty"` + BankIds *Relation `xmlrpc:"bank_ids,omitempty"` + Barcode *String `xmlrpc:"barcode,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"` + CommercialPartnerCountryId *Many2One `xmlrpc:"commercial_partner_country_id,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"` + CompanyType *Selection `xmlrpc:"company_type,omitempty"` + ContactAddress *String `xmlrpc:"contact_address,omitempty"` + ContractIds *Relation `xmlrpc:"contract_ids,omitempty"` + ContractsCount *Int `xmlrpc:"contracts_count,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"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + Customer *Bool `xmlrpc:"customer,omitempty"` + Date *Time `xmlrpc:"date,omitempty"` + Debit *Float `xmlrpc:"debit,omitempty"` + DebitLimit *Float `xmlrpc:"debit_limit,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Email *String `xmlrpc:"email,omitempty"` + EmailFormatted *String `xmlrpc:"email_formatted,omitempty"` + Employee *Bool `xmlrpc:"employee,omitempty"` + EmployeeIds *Relation `xmlrpc:"employee_ids,omitempty"` + Function *String `xmlrpc:"function,omitempty"` + GroupsId *Relation `xmlrpc:"groups_id,omitempty"` + HasUnreconciledEntries *Bool `xmlrpc:"has_unreconciled_entries,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + ImStatus *String `xmlrpc:"im_status,omitempty"` + Image *String `xmlrpc:"image,omitempty"` + ImageMedium *String `xmlrpc:"image_medium,omitempty"` + ImageSmall *String `xmlrpc:"image_small,omitempty"` + IndustryId *Many2One `xmlrpc:"industry_id,omitempty"` + InvoiceIds *Relation `xmlrpc:"invoice_ids,omitempty"` + InvoiceWarn *Selection `xmlrpc:"invoice_warn,omitempty"` + InvoiceWarnMsg *String `xmlrpc:"invoice_warn_msg,omitempty"` + IsCompany *Bool `xmlrpc:"is_company,omitempty"` + JournalItemCount *Int `xmlrpc:"journal_item_count,omitempty"` + Lang *Selection `xmlrpc:"lang,omitempty"` + LastTimeEntriesChecked *Time `xmlrpc:"last_time_entries_checked,omitempty"` + LogIds *Relation `xmlrpc:"log_ids,omitempty"` + Login *String `xmlrpc:"login,omitempty"` + LoginDate *Time `xmlrpc:"login_date,omitempty"` + MachineCompanyName *String `xmlrpc:"machine_company_name,omitempty"` + MachineUserEmail *String `xmlrpc:"machine_user_email,omitempty"` + MachineUserLogin *String `xmlrpc:"machine_user_login,omitempty"` + MeetingCount *Int `xmlrpc:"meeting_count,omitempty"` + MeetingIds *Relation `xmlrpc:"meeting_ids,omitempty"` + MessageBounce *Int `xmlrpc:"message_bounce,omitempty"` + MessageChannelIds *Relation `xmlrpc:"message_channel_ids,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageLastPost *Time `xmlrpc:"message_last_post,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MessageUnread *Bool `xmlrpc:"message_unread,omitempty"` + MessageUnreadCounter *Int `xmlrpc:"message_unread_counter,omitempty"` + Mobile *String `xmlrpc:"mobile,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + NewPassword *String `xmlrpc:"new_password,omitempty"` + NotificationType *Selection `xmlrpc:"notification_type,omitempty"` + OpportunityCount *Int `xmlrpc:"opportunity_count,omitempty"` + OpportunityIds *Relation `xmlrpc:"opportunity_ids,omitempty"` + OptOut *Bool `xmlrpc:"opt_out,omitempty"` + ParentId *Many2One `xmlrpc:"parent_id,omitempty"` + ParentName *String `xmlrpc:"parent_name,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PartnerShare *Bool `xmlrpc:"partner_share,omitempty"` + Password *String `xmlrpc:"password,omitempty"` + PasswordCrypt *String `xmlrpc:"password_crypt,omitempty"` + PaymentTokenCount *Int `xmlrpc:"payment_token_count,omitempty"` + PaymentTokenIds *Relation `xmlrpc:"payment_token_ids,omitempty"` + Phone *String `xmlrpc:"phone,omitempty"` + PickingWarn *Selection `xmlrpc:"picking_warn,omitempty"` + PickingWarnMsg *String `xmlrpc:"picking_warn_msg,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"` + PropertyAutosalesConfig *Many2One `xmlrpc:"property_autosales_config,omitempty"` + PropertyPaymentTermId *Many2One `xmlrpc:"property_payment_term_id,omitempty"` + PropertyProductPricelist *Many2One `xmlrpc:"property_product_pricelist,omitempty"` + PropertyPurchaseCurrencyId *Many2One `xmlrpc:"property_purchase_currency_id,omitempty"` + PropertyStockCustomer *Many2One `xmlrpc:"property_stock_customer,omitempty"` + PropertyStockSupplier *Many2One `xmlrpc:"property_stock_supplier,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"` + Ref *String `xmlrpc:"ref,omitempty"` + RefCompanyIds *Relation `xmlrpc:"ref_company_ids,omitempty"` + ResourceCalendarId *Many2One `xmlrpc:"resource_calendar_id,omitempty"` + ResourceIds *Relation `xmlrpc:"resource_ids,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"` + Self *Many2One `xmlrpc:"self,omitempty"` + Share *Bool `xmlrpc:"share,omitempty"` + Signature *String `xmlrpc:"signature,omitempty"` + SignupExpiration *Time `xmlrpc:"signup_expiration,omitempty"` + SignupToken *String `xmlrpc:"signup_token,omitempty"` + SignupType *String `xmlrpc:"signup_type,omitempty"` + SignupUrl *String `xmlrpc:"signup_url,omitempty"` + SignupValid *Bool `xmlrpc:"signup_valid,omitempty"` + Siret *String `xmlrpc:"siret,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + StateId *Many2One `xmlrpc:"state_id,omitempty"` + Street *String `xmlrpc:"street,omitempty"` + Street2 *String `xmlrpc:"street2,omitempty"` + Supplier *Bool `xmlrpc:"supplier,omitempty"` + SupplierInvoiceCount *Int `xmlrpc:"supplier_invoice_count,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"` + TeamId *Many2One `xmlrpc:"team_id,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"` + 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"` } // ResUserss represents array of res.users model. @@ -232,7 +232,7 @@ func (c *Client) FindResUsers(criteria *Criteria) (*ResUsers, error) { if rus != nil && len(*rus) > 0 { return &((*rus)[0]), nil } - return nil, fmt.Errorf("res.users was not found") + return nil, fmt.Errorf("no res.users was found with criteria %v", criteria) } // FindResUserss finds res.users records by querying it @@ -264,5 +264,5 @@ func (c *Client) FindResUsersId(criteria *Criteria, options *Options) (int64, er if len(ids) > 0 { return ids[0], nil } - return -1, fmt.Errorf("res.users was not found") + return -1, fmt.Errorf("no res.users was found with criteria %v and options %v", criteria, options) } diff --git a/res_users_log.go b/res_users_log.go new file mode 100644 index 00000000..fb5b95ef --- /dev/null +++ b/res_users_log.go @@ -0,0 +1,118 @@ +package odoo + +import ( + "fmt" +) + +// ResUsersLog represents res.users.log model. +type ResUsersLog struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` +} + +// 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) { + return c.Create(ResUsersLogModel, rul) +} + +// 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) +} + +// 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 + } + if ruls != nil && len(*ruls) > 0 { + return &((*ruls)[0]), nil + } + return nil, fmt.Errorf("id %v of res.users.log not found", id) +} + +// 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 + } + if ruls != nil && len(*ruls) > 0 { + return &((*ruls)[0]), nil + } + return nil, fmt.Errorf("no res.users.log was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(ResUsersLogModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no res.users.log was found with criteria %v and options %v", criteria, options) +} diff --git a/resource_calendar.go b/resource_calendar.go new file mode 100644 index 00000000..8732a390 --- /dev/null +++ b/resource_calendar.go @@ -0,0 +1,123 @@ +package odoo + +import ( + "fmt" +) + +// ResourceCalendar represents resource.calendar model. +type ResourceCalendar struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AttendanceIds *Relation `xmlrpc:"attendance_ids,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"` + GlobalLeaveIds *Relation `xmlrpc:"global_leave_ids,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LeaveIds *Relation `xmlrpc:"leave_ids,omitempty"` + Name *String `xmlrpc:"name,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) { + return c.Create(ResourceCalendarModel, rc) +} + +// 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) +} + +// 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 + } + if rcs != nil && len(*rcs) > 0 { + return &((*rcs)[0]), nil + } + return nil, fmt.Errorf("id %v of resource.calendar not found", id) +} + +// 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 + } + if rcs != nil && len(*rcs) > 0 { + return &((*rcs)[0]), nil + } + return nil, fmt.Errorf("no resource.calendar was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(ResourceCalendarModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no resource.calendar was found with criteria %v and options %v", criteria, options) +} diff --git a/resource_calendar_attendance.go b/resource_calendar_attendance.go new file mode 100644 index 00000000..5f0080c4 --- /dev/null +++ b/resource_calendar_attendance.go @@ -0,0 +1,125 @@ +package odoo + +import ( + "fmt" +) + +// ResourceCalendarAttendance represents resource.calendar.attendance model. +type ResourceCalendarAttendance struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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"` + Dayofweek *Selection `xmlrpc:"dayofweek,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + HourFrom *Float `xmlrpc:"hour_from,omitempty"` + HourTo *Float `xmlrpc:"hour_to,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,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) { + return c.Create(ResourceCalendarAttendanceModel, rca) +} + +// 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) +} + +// 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 + } + if rcas != nil && len(*rcas) > 0 { + return &((*rcas)[0]), nil + } + return nil, fmt.Errorf("id %v of resource.calendar.attendance not found", id) +} + +// 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 + } + if rcas != nil && len(*rcas) > 0 { + return &((*rcas)[0]), nil + } + return nil, fmt.Errorf("no resource.calendar.attendance was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(ResourceCalendarAttendanceModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no resource.calendar.attendance was found with criteria %v and options %v", criteria, options) +} diff --git a/resource_calendar_leaves.go b/resource_calendar_leaves.go new file mode 100644 index 00000000..ca7fc304 --- /dev/null +++ b/resource_calendar_leaves.go @@ -0,0 +1,126 @@ +package odoo + +import ( + "fmt" +) + +// ResourceCalendarLeaves represents resource.calendar.leaves model. +type ResourceCalendarLeaves struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` + 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"` + Tz *Selection `xmlrpc:"tz,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) { + return c.Create(ResourceCalendarLeavesModel, rcl) +} + +// 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) +} + +// 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 + } + if rcls != nil && len(*rcls) > 0 { + return &((*rcls)[0]), nil + } + return nil, fmt.Errorf("id %v of resource.calendar.leaves not found", id) +} + +// 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 + } + if rcls != nil && len(*rcls) > 0 { + return &((*rcls)[0]), nil + } + return nil, fmt.Errorf("no resource.calendar.leaves was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(ResourceCalendarLeavesModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no resource.calendar.leaves was found with criteria %v and options %v", criteria, options) +} diff --git a/resource_mixin.go b/resource_mixin.go new file mode 100644 index 00000000..863e93a5 --- /dev/null +++ b/resource_mixin.go @@ -0,0 +1,117 @@ +package odoo + +import ( + "fmt" +) + +// ResourceMixin represents resource.mixin model. +type ResourceMixin struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + ResourceCalendarId *Many2One `xmlrpc:"resource_calendar_id,omitempty"` + ResourceId *Many2One `xmlrpc:"resource_id,omitempty"` +} + +// ResourceMixins represents array of resource.mixin model. +type ResourceMixins []ResourceMixin + +// ResourceMixinModel is the odoo model name. +const ResourceMixinModel = "resource.mixin" + +// Many2One convert ResourceMixin to *Many2One. +func (rm *ResourceMixin) Many2One() *Many2One { + return NewMany2One(rm.Id.Get(), "") +} + +// CreateResourceMixin creates a new resource.mixin model and returns its id. +func (c *Client) CreateResourceMixin(rm *ResourceMixin) (int64, error) { + return c.Create(ResourceMixinModel, rm) +} + +// UpdateResourceMixin updates an existing resource.mixin record. +func (c *Client) UpdateResourceMixin(rm *ResourceMixin) error { + return c.UpdateResourceMixins([]int64{rm.Id.Get()}, rm) +} + +// UpdateResourceMixins updates existing resource.mixin records. +// All records (represented by ids) will be updated by rm values. +func (c *Client) UpdateResourceMixins(ids []int64, rm *ResourceMixin) error { + return c.Update(ResourceMixinModel, ids, rm) +} + +// DeleteResourceMixin deletes an existing resource.mixin record. +func (c *Client) DeleteResourceMixin(id int64) error { + return c.DeleteResourceMixins([]int64{id}) +} + +// DeleteResourceMixins deletes existing resource.mixin records. +func (c *Client) DeleteResourceMixins(ids []int64) error { + return c.Delete(ResourceMixinModel, ids) +} + +// GetResourceMixin gets resource.mixin existing record. +func (c *Client) GetResourceMixin(id int64) (*ResourceMixin, error) { + rms, err := c.GetResourceMixins([]int64{id}) + if err != nil { + return nil, err + } + if rms != nil && len(*rms) > 0 { + return &((*rms)[0]), nil + } + return nil, fmt.Errorf("id %v of resource.mixin not found", id) +} + +// GetResourceMixins gets resource.mixin existing records. +func (c *Client) GetResourceMixins(ids []int64) (*ResourceMixins, error) { + rms := &ResourceMixins{} + if err := c.Read(ResourceMixinModel, ids, nil, rms); err != nil { + return nil, err + } + return rms, nil +} + +// FindResourceMixin finds resource.mixin record by querying it with criteria. +func (c *Client) FindResourceMixin(criteria *Criteria) (*ResourceMixin, error) { + rms := &ResourceMixins{} + if err := c.SearchRead(ResourceMixinModel, criteria, NewOptions().Limit(1), rms); err != nil { + return nil, err + } + if rms != nil && len(*rms) > 0 { + return &((*rms)[0]), nil + } + return nil, fmt.Errorf("no resource.mixin was found with criteria %v", criteria) +} + +// FindResourceMixins finds resource.mixin records by querying it +// and filtering it with criteria and options. +func (c *Client) FindResourceMixins(criteria *Criteria, options *Options) (*ResourceMixins, error) { + rms := &ResourceMixins{} + if err := c.SearchRead(ResourceMixinModel, criteria, options, rms); err != nil { + return nil, err + } + return rms, nil +} + +// FindResourceMixinIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindResourceMixinIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(ResourceMixinModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindResourceMixinId finds record id by querying it with criteria. +func (c *Client) FindResourceMixinId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ResourceMixinModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no resource.mixin was found with criteria %v and options %v", criteria, options) +} diff --git a/resource_resource.go b/resource_resource.go new file mode 100644 index 00000000..1e542309 --- /dev/null +++ b/resource_resource.go @@ -0,0 +1,125 @@ +package odoo + +import ( + "fmt" +) + +// ResourceResource represents resource.resource model. +type ResourceResource struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + Active *Bool `xmlrpc:"active,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"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + ResourceType *Selection `xmlrpc:"resource_type,omitempty"` + TimeEfficiency *Float `xmlrpc:"time_efficiency,omitempty"` + UserId *Many2One `xmlrpc:"user_id,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) { + return c.Create(ResourceResourceModel, rr) +} + +// 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) +} + +// 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 + } + if rrs != nil && len(*rrs) > 0 { + return &((*rrs)[0]), nil + } + return nil, fmt.Errorf("id %v of resource.resource not found", id) +} + +// 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 + } + if rrs != nil && len(*rrs) > 0 { + return &((*rrs)[0]), nil + } + return nil, fmt.Errorf("no resource.resource was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(ResourceResourceModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no resource.resource was found with criteria %v and options %v", criteria, options) +} diff --git a/resource_test.go b/resource_test.go new file mode 100644 index 00000000..d0740c8a --- /dev/null +++ b/resource_test.go @@ -0,0 +1,122 @@ +package odoo + +import ( + "fmt" +) + +// ResourceTest represents resource.test model. +type ResourceTest struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` + ResourceCalendarId *Many2One `xmlrpc:"resource_calendar_id,omitempty"` + ResourceId *Many2One `xmlrpc:"resource_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ResourceTests represents array of resource.test model. +type ResourceTests []ResourceTest + +// ResourceTestModel is the odoo model name. +const ResourceTestModel = "resource.test" + +// Many2One convert ResourceTest to *Many2One. +func (rt *ResourceTest) Many2One() *Many2One { + return NewMany2One(rt.Id.Get(), "") +} + +// CreateResourceTest creates a new resource.test model and returns its id. +func (c *Client) CreateResourceTest(rt *ResourceTest) (int64, error) { + return c.Create(ResourceTestModel, rt) +} + +// UpdateResourceTest updates an existing resource.test record. +func (c *Client) UpdateResourceTest(rt *ResourceTest) error { + return c.UpdateResourceTests([]int64{rt.Id.Get()}, rt) +} + +// UpdateResourceTests updates existing resource.test records. +// All records (represented by ids) will be updated by rt values. +func (c *Client) UpdateResourceTests(ids []int64, rt *ResourceTest) error { + return c.Update(ResourceTestModel, ids, rt) +} + +// DeleteResourceTest deletes an existing resource.test record. +func (c *Client) DeleteResourceTest(id int64) error { + return c.DeleteResourceTests([]int64{id}) +} + +// DeleteResourceTests deletes existing resource.test records. +func (c *Client) DeleteResourceTests(ids []int64) error { + return c.Delete(ResourceTestModel, ids) +} + +// GetResourceTest gets resource.test existing record. +func (c *Client) GetResourceTest(id int64) (*ResourceTest, error) { + rts, err := c.GetResourceTests([]int64{id}) + if err != nil { + return nil, err + } + if rts != nil && len(*rts) > 0 { + return &((*rts)[0]), nil + } + return nil, fmt.Errorf("id %v of resource.test not found", id) +} + +// GetResourceTests gets resource.test existing records. +func (c *Client) GetResourceTests(ids []int64) (*ResourceTests, error) { + rts := &ResourceTests{} + if err := c.Read(ResourceTestModel, ids, nil, rts); err != nil { + return nil, err + } + return rts, nil +} + +// FindResourceTest finds resource.test record by querying it with criteria. +func (c *Client) FindResourceTest(criteria *Criteria) (*ResourceTest, error) { + rts := &ResourceTests{} + if err := c.SearchRead(ResourceTestModel, criteria, NewOptions().Limit(1), rts); err != nil { + return nil, err + } + if rts != nil && len(*rts) > 0 { + return &((*rts)[0]), nil + } + return nil, fmt.Errorf("no resource.test was found with criteria %v", criteria) +} + +// FindResourceTests finds resource.test records by querying it +// and filtering it with criteria and options. +func (c *Client) FindResourceTests(criteria *Criteria, options *Options) (*ResourceTests, error) { + rts := &ResourceTests{} + if err := c.SearchRead(ResourceTestModel, criteria, options, rts); err != nil { + return nil, err + } + return rts, nil +} + +// FindResourceTestIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindResourceTestIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(ResourceTestModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindResourceTestId finds record id by querying it with criteria. +func (c *Client) FindResourceTestId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ResourceTestModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no resource.test was found with criteria %v and options %v", criteria, options) +} diff --git a/sale_advance_payment_inv.go b/sale_advance_payment_inv.go new file mode 100644 index 00000000..83a6ab5b --- /dev/null +++ b/sale_advance_payment_inv.go @@ -0,0 +1,124 @@ +package odoo + +import ( + "fmt" +) + +// SaleAdvancePaymentInv represents sale.advance.payment.inv model. +type SaleAdvancePaymentInv struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AdvancePaymentMethod *Selection `xmlrpc:"advance_payment_method,omitempty"` + Amount *Float `xmlrpc:"amount,omitempty"` + Count *Int `xmlrpc:"count,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DepositAccountId *Many2One `xmlrpc:"deposit_account_id,omitempty"` + DepositTaxesId *Relation `xmlrpc:"deposit_taxes_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + ProductId *Many2One `xmlrpc:"product_id,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) { + return c.Create(SaleAdvancePaymentInvModel, sapi) +} + +// 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) +} + +// 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 + } + if sapis != nil && len(*sapis) > 0 { + return &((*sapis)[0]), nil + } + return nil, fmt.Errorf("id %v of sale.advance.payment.inv not found", id) +} + +// 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 + } + if sapis != nil && len(*sapis) > 0 { + return &((*sapis)[0]), nil + } + return nil, fmt.Errorf("no sale.advance.payment.inv was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(SaleAdvancePaymentInvModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no sale.advance.payment.inv was found with criteria %v and options %v", criteria, options) +} diff --git a/sale_layout_category.go b/sale_layout_category.go new file mode 100644 index 00000000..197fdd4c --- /dev/null +++ b/sale_layout_category.go @@ -0,0 +1,122 @@ +package odoo + +import ( + "fmt" +) + +// SaleLayoutCategory represents sale.layout_category model. +type SaleLayoutCategory struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` + Pagebreak *Bool `xmlrpc:"pagebreak,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + Subtotal *Bool `xmlrpc:"subtotal,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// SaleLayoutCategorys represents array of sale.layout_category model. +type SaleLayoutCategorys []SaleLayoutCategory + +// SaleLayoutCategoryModel is the odoo model name. +const SaleLayoutCategoryModel = "sale.layout_category" + +// Many2One convert SaleLayoutCategory to *Many2One. +func (sl *SaleLayoutCategory) Many2One() *Many2One { + return NewMany2One(sl.Id.Get(), "") +} + +// CreateSaleLayoutCategory creates a new sale.layout_category model and returns its id. +func (c *Client) CreateSaleLayoutCategory(sl *SaleLayoutCategory) (int64, error) { + return c.Create(SaleLayoutCategoryModel, sl) +} + +// UpdateSaleLayoutCategory updates an existing sale.layout_category record. +func (c *Client) UpdateSaleLayoutCategory(sl *SaleLayoutCategory) error { + return c.UpdateSaleLayoutCategorys([]int64{sl.Id.Get()}, sl) +} + +// UpdateSaleLayoutCategorys updates existing sale.layout_category records. +// All records (represented by ids) will be updated by sl values. +func (c *Client) UpdateSaleLayoutCategorys(ids []int64, sl *SaleLayoutCategory) error { + return c.Update(SaleLayoutCategoryModel, ids, sl) +} + +// DeleteSaleLayoutCategory deletes an existing sale.layout_category record. +func (c *Client) DeleteSaleLayoutCategory(id int64) error { + return c.DeleteSaleLayoutCategorys([]int64{id}) +} + +// DeleteSaleLayoutCategorys deletes existing sale.layout_category records. +func (c *Client) DeleteSaleLayoutCategorys(ids []int64) error { + return c.Delete(SaleLayoutCategoryModel, ids) +} + +// GetSaleLayoutCategory gets sale.layout_category existing record. +func (c *Client) GetSaleLayoutCategory(id int64) (*SaleLayoutCategory, error) { + sls, err := c.GetSaleLayoutCategorys([]int64{id}) + if err != nil { + return nil, err + } + if sls != nil && len(*sls) > 0 { + return &((*sls)[0]), nil + } + return nil, fmt.Errorf("id %v of sale.layout_category not found", id) +} + +// GetSaleLayoutCategorys gets sale.layout_category existing records. +func (c *Client) GetSaleLayoutCategorys(ids []int64) (*SaleLayoutCategorys, error) { + sls := &SaleLayoutCategorys{} + if err := c.Read(SaleLayoutCategoryModel, ids, nil, sls); err != nil { + return nil, err + } + return sls, nil +} + +// FindSaleLayoutCategory finds sale.layout_category record by querying it with criteria. +func (c *Client) FindSaleLayoutCategory(criteria *Criteria) (*SaleLayoutCategory, error) { + sls := &SaleLayoutCategorys{} + if err := c.SearchRead(SaleLayoutCategoryModel, criteria, NewOptions().Limit(1), sls); err != nil { + return nil, err + } + if sls != nil && len(*sls) > 0 { + return &((*sls)[0]), nil + } + return nil, fmt.Errorf("no sale.layout_category was found with criteria %v", criteria) +} + +// FindSaleLayoutCategorys finds sale.layout_category records by querying it +// and filtering it with criteria and options. +func (c *Client) FindSaleLayoutCategorys(criteria *Criteria, options *Options) (*SaleLayoutCategorys, error) { + sls := &SaleLayoutCategorys{} + if err := c.SearchRead(SaleLayoutCategoryModel, criteria, options, sls); err != nil { + return nil, err + } + return sls, nil +} + +// FindSaleLayoutCategoryIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindSaleLayoutCategoryIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(SaleLayoutCategoryModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindSaleLayoutCategoryId finds record id by querying it with criteria. +func (c *Client) FindSaleLayoutCategoryId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(SaleLayoutCategoryModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no sale.layout_category was found with criteria %v and options %v", criteria, options) +} diff --git a/sale_order.go b/sale_order.go new file mode 100644 index 00000000..56ffc723 --- /dev/null +++ b/sale_order.go @@ -0,0 +1,186 @@ +package odoo + +import ( + "fmt" +) + +// SaleOrder represents sale.order model. +type SaleOrder struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AccessToken *String `xmlrpc:"access_token,omitempty"` + ActivityDateDeadline *Time `xmlrpc:"activity_date_deadline,omitempty"` + ActivityIds *Relation `xmlrpc:"activity_ids,omitempty"` + ActivityState *Selection `xmlrpc:"activity_state,omitempty"` + ActivitySummary *String `xmlrpc:"activity_summary,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"` + AmountUntaxed *Float `xmlrpc:"amount_untaxed,omitempty"` + AnalyticAccountId *Many2One `xmlrpc:"analytic_account_id,omitempty"` + AutosalesConfigId *Many2One `xmlrpc:"autosales_config_id,omitempty"` + CampaignId *Many2One `xmlrpc:"campaign_id,omitempty"` + ClientOrderRef *String `xmlrpc:"client_order_ref,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + ConfirmationDate *Time `xmlrpc:"confirmation_date,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + DateOrder *Time `xmlrpc:"date_order,omitempty"` + DeliveryCount *Int `xmlrpc:"delivery_count,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + FiscalPositionId *Many2One `xmlrpc:"fiscal_position_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Incoterm *Many2One `xmlrpc:"incoterm,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"` + MediumId *Many2One `xmlrpc:"medium_id,omitempty"` + MessageChannelIds *Relation `xmlrpc:"message_channel_ids,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageLastPost *Time `xmlrpc:"message_last_post,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MessageUnread *Bool `xmlrpc:"message_unread,omitempty"` + MessageUnreadCounter *Int `xmlrpc:"message_unread_counter,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"` + 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"` + PickingIds *Relation `xmlrpc:"picking_ids,omitempty"` + PickingPolicy *Selection `xmlrpc:"picking_policy,omitempty"` + PortalUrl *String `xmlrpc:"portal_url,omitempty"` + PricelistId *Many2One `xmlrpc:"pricelist_id,omitempty"` + ProcurementGroupId *Many2One `xmlrpc:"procurement_group_id,omitempty"` + ProductId *Many2One `xmlrpc:"product_id,omitempty"` + ProjectIds *Relation `xmlrpc:"project_ids,omitempty"` + ProjectProjectId *Many2One `xmlrpc:"project_project_id,omitempty"` + SourceId *Many2One `xmlrpc:"source_id,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + TagIds *Relation `xmlrpc:"tag_ids,omitempty"` + TasksCount *Int `xmlrpc:"tasks_count,omitempty"` + TasksCreated *Bool `xmlrpc:"tasks_created,omitempty"` + TasksIds *Relation `xmlrpc:"tasks_ids,omitempty"` + TeamId *Many2One `xmlrpc:"team_id,omitempty"` + TimesheetCount *Float `xmlrpc:"timesheet_count,omitempty"` + TimesheetIds *Relation `xmlrpc:"timesheet_ids,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + ValidityDate *Time `xmlrpc:"validity_date,omitempty"` + WarehouseId *Many2One `xmlrpc:"warehouse_id,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` + XTitle *String `xmlrpc:"x_title,omitempty"` + XTitleReadOnly *String `xmlrpc:"x_title_read_only,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) { + return c.Create(SaleOrderModel, so) +} + +// 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) +} + +// 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 + } + if sos != nil && len(*sos) > 0 { + return &((*sos)[0]), nil + } + return nil, fmt.Errorf("id %v of sale.order not found", id) +} + +// 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 + } + if sos != nil && len(*sos) > 0 { + return &((*sos)[0]), nil + } + return nil, fmt.Errorf("no sale.order was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(SaleOrderModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no sale.order was found with criteria %v and options %v", criteria, options) +} diff --git a/sale_order_line.go b/sale_order_line.go new file mode 100644 index 00000000..6fd0ab6a --- /dev/null +++ b/sale_order_line.go @@ -0,0 +1,160 @@ +package odoo + +import ( + "fmt" +) + +// SaleOrderLine represents sale.order.line model. +type SaleOrderLine struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AmtInvoiced *Float `xmlrpc:"amt_invoiced,omitempty"` + AmtToInvoice *Float `xmlrpc:"amt_to_invoice,omitempty"` + AnalyticTagIds *Relation `xmlrpc:"analytic_tag_ids,omitempty"` + AutosalesBaseOrderLine *Many2One `xmlrpc:"autosales_base_order_line,omitempty"` + AutosalesLine *Bool `xmlrpc:"autosales_line,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"` + CustomerLead *Float `xmlrpc:"customer_lead,omitempty"` + Discount *Float `xmlrpc:"discount,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + InvoiceLines *Relation `xmlrpc:"invoice_lines,omitempty"` + InvoiceStatus *Selection `xmlrpc:"invoice_status,omitempty"` + IsDownpayment *Bool `xmlrpc:"is_downpayment,omitempty"` + IsService *Bool `xmlrpc:"is_service,omitempty"` + LayoutCategoryId *Many2One `xmlrpc:"layout_category_id,omitempty"` + LayoutCategorySequence *Int `xmlrpc:"layout_category_sequence,omitempty"` + MoveIds *Relation `xmlrpc:"move_ids,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + OrderId *Many2One `xmlrpc:"order_id,omitempty"` + OrderPartnerId *Many2One `xmlrpc:"order_partner_id,omitempty"` + PriceReduce *Float `xmlrpc:"price_reduce,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"` + ProductId *Many2One `xmlrpc:"product_id,omitempty"` + ProductImage *String `xmlrpc:"product_image,omitempty"` + ProductPackaging *Many2One `xmlrpc:"product_packaging,omitempty"` + ProductUom *Many2One `xmlrpc:"product_uom,omitempty"` + ProductUomQty *Float `xmlrpc:"product_uom_qty,omitempty"` + ProductUpdatable *Bool `xmlrpc:"product_updatable,omitempty"` + QtyDelivered *Float `xmlrpc:"qty_delivered,omitempty"` + QtyDeliveredUpdateable *Bool `xmlrpc:"qty_delivered_updateable,omitempty"` + QtyInvoiced *Float `xmlrpc:"qty_invoiced,omitempty"` + QtyToInvoice *Float `xmlrpc:"qty_to_invoice,omitempty"` + RouteId *Many2One `xmlrpc:"route_id,omitempty"` + SalesmanId *Many2One `xmlrpc:"salesman_id,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + TaskId *Many2One `xmlrpc:"task_id,omitempty"` + TaxId *Relation `xmlrpc:"tax_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) { + return c.Create(SaleOrderLineModel, sol) +} + +// 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) +} + +// 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 + } + if sols != nil && len(*sols) > 0 { + return &((*sols)[0]), nil + } + return nil, fmt.Errorf("id %v of sale.order.line not found", id) +} + +// 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 + } + if sols != nil && len(*sols) > 0 { + return &((*sols)[0]), nil + } + return nil, fmt.Errorf("no sale.order.line was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(SaleOrderLineModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no sale.order.line was found with criteria %v and options %v", criteria, options) +} diff --git a/sale_report.go b/sale_report.go new file mode 100644 index 00000000..022d02d6 --- /dev/null +++ b/sale_report.go @@ -0,0 +1,142 @@ +package odoo + +import ( + "fmt" +) + +// SaleReport represents sale.report model. +type SaleReport struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AmtInvoiced *Float `xmlrpc:"amt_invoiced,omitempty"` + AmtToInvoice *Float `xmlrpc:"amt_to_invoice,omitempty"` + AnalyticAccountId *Many2One `xmlrpc:"analytic_account_id,omitempty"` + CategId *Many2One `xmlrpc:"categ_id,omitempty"` + CommercialPartnerId *Many2One `xmlrpc:"commercial_partner_id,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + ConfirmationDate *Time `xmlrpc:"confirmation_date,omitempty"` + CountryId *Many2One `xmlrpc:"country_id,omitempty"` + Date *Time `xmlrpc:"date,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Nbr *Int `xmlrpc:"nbr,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PriceSubtotal *Float `xmlrpc:"price_subtotal,omitempty"` + PriceTotal *Float `xmlrpc:"price_total,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"` + QtyDelivered *Float `xmlrpc:"qty_delivered,omitempty"` + QtyInvoiced *Float `xmlrpc:"qty_invoiced,omitempty"` + QtyToInvoice *Float `xmlrpc:"qty_to_invoice,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + TeamId *Many2One `xmlrpc:"team_id,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + Volume *Float `xmlrpc:"volume,omitempty"` + WarehouseId *Many2One `xmlrpc:"warehouse_id,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) { + return c.Create(SaleReportModel, sr) +} + +// 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) +} + +// 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 + } + if srs != nil && len(*srs) > 0 { + return &((*srs)[0]), nil + } + return nil, fmt.Errorf("id %v of sale.report not found", id) +} + +// 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 + } + if srs != nil && len(*srs) > 0 { + return &((*srs)[0]), nil + } + return nil, fmt.Errorf("no sale.report was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(SaleReportModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no sale.report was found with criteria %v and options %v", criteria, options) +} diff --git a/sms_api.go b/sms_api.go new file mode 100644 index 00000000..69897b11 --- /dev/null +++ b/sms_api.go @@ -0,0 +1,114 @@ +package odoo + +import ( + "fmt" +) + +// SmsApi represents sms.api model. +type SmsApi struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` +} + +// SmsApis represents array of sms.api model. +type SmsApis []SmsApi + +// SmsApiModel is the odoo model name. +const SmsApiModel = "sms.api" + +// Many2One convert SmsApi to *Many2One. +func (sa *SmsApi) Many2One() *Many2One { + return NewMany2One(sa.Id.Get(), "") +} + +// CreateSmsApi creates a new sms.api model and returns its id. +func (c *Client) CreateSmsApi(sa *SmsApi) (int64, error) { + return c.Create(SmsApiModel, sa) +} + +// UpdateSmsApi updates an existing sms.api record. +func (c *Client) UpdateSmsApi(sa *SmsApi) error { + return c.UpdateSmsApis([]int64{sa.Id.Get()}, sa) +} + +// UpdateSmsApis updates existing sms.api records. +// All records (represented by ids) will be updated by sa values. +func (c *Client) UpdateSmsApis(ids []int64, sa *SmsApi) error { + return c.Update(SmsApiModel, ids, sa) +} + +// DeleteSmsApi deletes an existing sms.api record. +func (c *Client) DeleteSmsApi(id int64) error { + return c.DeleteSmsApis([]int64{id}) +} + +// DeleteSmsApis deletes existing sms.api records. +func (c *Client) DeleteSmsApis(ids []int64) error { + return c.Delete(SmsApiModel, ids) +} + +// GetSmsApi gets sms.api existing record. +func (c *Client) GetSmsApi(id int64) (*SmsApi, error) { + sas, err := c.GetSmsApis([]int64{id}) + if err != nil { + return nil, err + } + if sas != nil && len(*sas) > 0 { + return &((*sas)[0]), nil + } + return nil, fmt.Errorf("id %v of sms.api not found", id) +} + +// GetSmsApis gets sms.api existing records. +func (c *Client) GetSmsApis(ids []int64) (*SmsApis, error) { + sas := &SmsApis{} + if err := c.Read(SmsApiModel, ids, nil, sas); err != nil { + return nil, err + } + return sas, nil +} + +// FindSmsApi finds sms.api record by querying it with criteria. +func (c *Client) FindSmsApi(criteria *Criteria) (*SmsApi, error) { + sas := &SmsApis{} + if err := c.SearchRead(SmsApiModel, criteria, NewOptions().Limit(1), sas); err != nil { + return nil, err + } + if sas != nil && len(*sas) > 0 { + return &((*sas)[0]), nil + } + return nil, fmt.Errorf("no sms.api was found with criteria %v", criteria) +} + +// FindSmsApis finds sms.api records by querying it +// and filtering it with criteria and options. +func (c *Client) FindSmsApis(criteria *Criteria, options *Options) (*SmsApis, error) { + sas := &SmsApis{} + if err := c.SearchRead(SmsApiModel, criteria, options, sas); err != nil { + return nil, err + } + return sas, nil +} + +// FindSmsApiIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindSmsApiIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(SmsApiModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindSmsApiId finds record id by querying it with criteria. +func (c *Client) FindSmsApiId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(SmsApiModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no sms.api was found with criteria %v and options %v", criteria, options) +} diff --git a/sms_send_sms.go b/sms_send_sms.go new file mode 100644 index 00000000..88a3aca3 --- /dev/null +++ b/sms_send_sms.go @@ -0,0 +1,120 @@ +package odoo + +import ( + "fmt" +) + +// SmsSendSms represents sms.send_sms model. +type SmsSendSms struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` + Recipients *String `xmlrpc:"recipients,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// SmsSendSmss represents array of sms.send_sms model. +type SmsSendSmss []SmsSendSms + +// SmsSendSmsModel is the odoo model name. +const SmsSendSmsModel = "sms.send_sms" + +// Many2One convert SmsSendSms to *Many2One. +func (ss *SmsSendSms) Many2One() *Many2One { + return NewMany2One(ss.Id.Get(), "") +} + +// CreateSmsSendSms creates a new sms.send_sms model and returns its id. +func (c *Client) CreateSmsSendSms(ss *SmsSendSms) (int64, error) { + return c.Create(SmsSendSmsModel, ss) +} + +// UpdateSmsSendSms updates an existing sms.send_sms record. +func (c *Client) UpdateSmsSendSms(ss *SmsSendSms) error { + return c.UpdateSmsSendSmss([]int64{ss.Id.Get()}, ss) +} + +// UpdateSmsSendSmss updates existing sms.send_sms records. +// All records (represented by ids) will be updated by ss values. +func (c *Client) UpdateSmsSendSmss(ids []int64, ss *SmsSendSms) error { + return c.Update(SmsSendSmsModel, ids, ss) +} + +// DeleteSmsSendSms deletes an existing sms.send_sms record. +func (c *Client) DeleteSmsSendSms(id int64) error { + return c.DeleteSmsSendSmss([]int64{id}) +} + +// DeleteSmsSendSmss deletes existing sms.send_sms records. +func (c *Client) DeleteSmsSendSmss(ids []int64) error { + return c.Delete(SmsSendSmsModel, ids) +} + +// GetSmsSendSms gets sms.send_sms existing record. +func (c *Client) GetSmsSendSms(id int64) (*SmsSendSms, error) { + sss, err := c.GetSmsSendSmss([]int64{id}) + if err != nil { + return nil, err + } + if sss != nil && len(*sss) > 0 { + return &((*sss)[0]), nil + } + return nil, fmt.Errorf("id %v of sms.send_sms not found", id) +} + +// GetSmsSendSmss gets sms.send_sms existing records. +func (c *Client) GetSmsSendSmss(ids []int64) (*SmsSendSmss, error) { + sss := &SmsSendSmss{} + if err := c.Read(SmsSendSmsModel, ids, nil, sss); err != nil { + return nil, err + } + return sss, nil +} + +// FindSmsSendSms finds sms.send_sms record by querying it with criteria. +func (c *Client) FindSmsSendSms(criteria *Criteria) (*SmsSendSms, error) { + sss := &SmsSendSmss{} + if err := c.SearchRead(SmsSendSmsModel, criteria, NewOptions().Limit(1), sss); err != nil { + return nil, err + } + if sss != nil && len(*sss) > 0 { + return &((*sss)[0]), nil + } + return nil, fmt.Errorf("no sms.send_sms was found with criteria %v", criteria) +} + +// FindSmsSendSmss finds sms.send_sms records by querying it +// and filtering it with criteria and options. +func (c *Client) FindSmsSendSmss(criteria *Criteria, options *Options) (*SmsSendSmss, error) { + sss := &SmsSendSmss{} + if err := c.SearchRead(SmsSendSmsModel, criteria, options, sss); err != nil { + return nil, err + } + return sss, nil +} + +// FindSmsSendSmsIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindSmsSendSmsIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(SmsSendSmsModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindSmsSendSmsId finds record id by querying it with criteria. +func (c *Client) FindSmsSendSmsId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(SmsSendSmsModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no sms.send_sms was found with criteria %v and options %v", criteria, options) +} diff --git a/sparse_fields_test.go b/sparse_fields_test.go new file mode 100644 index 00000000..b5b244e5 --- /dev/null +++ b/sparse_fields_test.go @@ -0,0 +1,125 @@ +package odoo + +import ( + "fmt" +) + +// SparseFieldsTest represents sparse_fields.test model. +type SparseFieldsTest struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + Boolean *Bool `xmlrpc:"boolean,omitempty"` + Char *String `xmlrpc:"char,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Data interface{} `xmlrpc:"data,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Float *Float `xmlrpc:"float,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Integer *Int `xmlrpc:"integer,omitempty"` + Partner *Many2One `xmlrpc:"partner,omitempty"` + Selection *Selection `xmlrpc:"selection,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// SparseFieldsTests represents array of sparse_fields.test model. +type SparseFieldsTests []SparseFieldsTest + +// SparseFieldsTestModel is the odoo model name. +const SparseFieldsTestModel = "sparse_fields.test" + +// Many2One convert SparseFieldsTest to *Many2One. +func (st *SparseFieldsTest) Many2One() *Many2One { + return NewMany2One(st.Id.Get(), "") +} + +// CreateSparseFieldsTest creates a new sparse_fields.test model and returns its id. +func (c *Client) CreateSparseFieldsTest(st *SparseFieldsTest) (int64, error) { + return c.Create(SparseFieldsTestModel, st) +} + +// UpdateSparseFieldsTest updates an existing sparse_fields.test record. +func (c *Client) UpdateSparseFieldsTest(st *SparseFieldsTest) error { + return c.UpdateSparseFieldsTests([]int64{st.Id.Get()}, st) +} + +// UpdateSparseFieldsTests updates existing sparse_fields.test records. +// All records (represented by ids) will be updated by st values. +func (c *Client) UpdateSparseFieldsTests(ids []int64, st *SparseFieldsTest) error { + return c.Update(SparseFieldsTestModel, ids, st) +} + +// DeleteSparseFieldsTest deletes an existing sparse_fields.test record. +func (c *Client) DeleteSparseFieldsTest(id int64) error { + return c.DeleteSparseFieldsTests([]int64{id}) +} + +// DeleteSparseFieldsTests deletes existing sparse_fields.test records. +func (c *Client) DeleteSparseFieldsTests(ids []int64) error { + return c.Delete(SparseFieldsTestModel, ids) +} + +// GetSparseFieldsTest gets sparse_fields.test existing record. +func (c *Client) GetSparseFieldsTest(id int64) (*SparseFieldsTest, error) { + sts, err := c.GetSparseFieldsTests([]int64{id}) + if err != nil { + return nil, err + } + if sts != nil && len(*sts) > 0 { + return &((*sts)[0]), nil + } + return nil, fmt.Errorf("id %v of sparse_fields.test not found", id) +} + +// GetSparseFieldsTests gets sparse_fields.test existing records. +func (c *Client) GetSparseFieldsTests(ids []int64) (*SparseFieldsTests, error) { + sts := &SparseFieldsTests{} + if err := c.Read(SparseFieldsTestModel, ids, nil, sts); err != nil { + return nil, err + } + return sts, nil +} + +// FindSparseFieldsTest finds sparse_fields.test record by querying it with criteria. +func (c *Client) FindSparseFieldsTest(criteria *Criteria) (*SparseFieldsTest, error) { + sts := &SparseFieldsTests{} + if err := c.SearchRead(SparseFieldsTestModel, criteria, NewOptions().Limit(1), sts); err != nil { + return nil, err + } + if sts != nil && len(*sts) > 0 { + return &((*sts)[0]), nil + } + return nil, fmt.Errorf("no sparse_fields.test was found with criteria %v", criteria) +} + +// FindSparseFieldsTests finds sparse_fields.test records by querying it +// and filtering it with criteria and options. +func (c *Client) FindSparseFieldsTests(criteria *Criteria, options *Options) (*SparseFieldsTests, error) { + sts := &SparseFieldsTests{} + if err := c.SearchRead(SparseFieldsTestModel, criteria, options, sts); err != nil { + return nil, err + } + return sts, nil +} + +// FindSparseFieldsTestIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindSparseFieldsTestIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(SparseFieldsTestModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindSparseFieldsTestId finds record id by querying it with criteria. +func (c *Client) FindSparseFieldsTestId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(SparseFieldsTestModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no sparse_fields.test was found with criteria %v and options %v", criteria, options) +} diff --git a/stock_backorder_confirmation.go b/stock_backorder_confirmation.go new file mode 100644 index 00000000..f294339a --- /dev/null +++ b/stock_backorder_confirmation.go @@ -0,0 +1,119 @@ +package odoo + +import ( + "fmt" +) + +// StockBackorderConfirmation represents stock.backorder.confirmation model. +type StockBackorderConfirmation struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + PickIds *Relation `xmlrpc:"pick_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// StockBackorderConfirmations represents array of stock.backorder.confirmation model. +type StockBackorderConfirmations []StockBackorderConfirmation + +// StockBackorderConfirmationModel is the odoo model name. +const StockBackorderConfirmationModel = "stock.backorder.confirmation" + +// Many2One convert StockBackorderConfirmation to *Many2One. +func (sbc *StockBackorderConfirmation) Many2One() *Many2One { + return NewMany2One(sbc.Id.Get(), "") +} + +// CreateStockBackorderConfirmation creates a new stock.backorder.confirmation model and returns its id. +func (c *Client) CreateStockBackorderConfirmation(sbc *StockBackorderConfirmation) (int64, error) { + return c.Create(StockBackorderConfirmationModel, sbc) +} + +// UpdateStockBackorderConfirmation updates an existing stock.backorder.confirmation record. +func (c *Client) UpdateStockBackorderConfirmation(sbc *StockBackorderConfirmation) error { + return c.UpdateStockBackorderConfirmations([]int64{sbc.Id.Get()}, sbc) +} + +// UpdateStockBackorderConfirmations updates existing stock.backorder.confirmation records. +// All records (represented by ids) will be updated by sbc values. +func (c *Client) UpdateStockBackorderConfirmations(ids []int64, sbc *StockBackorderConfirmation) error { + return c.Update(StockBackorderConfirmationModel, ids, sbc) +} + +// DeleteStockBackorderConfirmation deletes an existing stock.backorder.confirmation record. +func (c *Client) DeleteStockBackorderConfirmation(id int64) error { + return c.DeleteStockBackorderConfirmations([]int64{id}) +} + +// DeleteStockBackorderConfirmations deletes existing stock.backorder.confirmation records. +func (c *Client) DeleteStockBackorderConfirmations(ids []int64) error { + return c.Delete(StockBackorderConfirmationModel, ids) +} + +// GetStockBackorderConfirmation gets stock.backorder.confirmation existing record. +func (c *Client) GetStockBackorderConfirmation(id int64) (*StockBackorderConfirmation, error) { + sbcs, err := c.GetStockBackorderConfirmations([]int64{id}) + if err != nil { + return nil, err + } + if sbcs != nil && len(*sbcs) > 0 { + return &((*sbcs)[0]), nil + } + return nil, fmt.Errorf("id %v of stock.backorder.confirmation not found", id) +} + +// GetStockBackorderConfirmations gets stock.backorder.confirmation existing records. +func (c *Client) GetStockBackorderConfirmations(ids []int64) (*StockBackorderConfirmations, error) { + sbcs := &StockBackorderConfirmations{} + if err := c.Read(StockBackorderConfirmationModel, ids, nil, sbcs); err != nil { + return nil, err + } + return sbcs, nil +} + +// FindStockBackorderConfirmation finds stock.backorder.confirmation record by querying it with criteria. +func (c *Client) FindStockBackorderConfirmation(criteria *Criteria) (*StockBackorderConfirmation, error) { + sbcs := &StockBackorderConfirmations{} + if err := c.SearchRead(StockBackorderConfirmationModel, criteria, NewOptions().Limit(1), sbcs); err != nil { + return nil, err + } + if sbcs != nil && len(*sbcs) > 0 { + return &((*sbcs)[0]), nil + } + return nil, fmt.Errorf("no stock.backorder.confirmation was found with criteria %v", criteria) +} + +// FindStockBackorderConfirmations finds stock.backorder.confirmation records by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockBackorderConfirmations(criteria *Criteria, options *Options) (*StockBackorderConfirmations, error) { + sbcs := &StockBackorderConfirmations{} + if err := c.SearchRead(StockBackorderConfirmationModel, criteria, options, sbcs); err != nil { + return nil, err + } + return sbcs, nil +} + +// FindStockBackorderConfirmationIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockBackorderConfirmationIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(StockBackorderConfirmationModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindStockBackorderConfirmationId finds record id by querying it with criteria. +func (c *Client) FindStockBackorderConfirmationId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(StockBackorderConfirmationModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no stock.backorder.confirmation was found with criteria %v and options %v", criteria, options) +} diff --git a/stock_change_product_qty.go b/stock_change_product_qty.go new file mode 100644 index 00000000..886fca02 --- /dev/null +++ b/stock_change_product_qty.go @@ -0,0 +1,124 @@ +package odoo + +import ( + "fmt" +) + +// StockChangeProductQty represents stock.change.product.qty model. +type StockChangeProductQty struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LocationId *Many2One `xmlrpc:"location_id,omitempty"` + LotId *Many2One `xmlrpc:"lot_id,omitempty"` + NewQuantity *Float `xmlrpc:"new_quantity,omitempty"` + ProductId *Many2One `xmlrpc:"product_id,omitempty"` + ProductTmplId *Many2One `xmlrpc:"product_tmpl_id,omitempty"` + ProductVariantCount *Int `xmlrpc:"product_variant_count,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// StockChangeProductQtys represents array of stock.change.product.qty model. +type StockChangeProductQtys []StockChangeProductQty + +// StockChangeProductQtyModel is the odoo model name. +const StockChangeProductQtyModel = "stock.change.product.qty" + +// Many2One convert StockChangeProductQty to *Many2One. +func (scpq *StockChangeProductQty) Many2One() *Many2One { + return NewMany2One(scpq.Id.Get(), "") +} + +// CreateStockChangeProductQty creates a new stock.change.product.qty model and returns its id. +func (c *Client) CreateStockChangeProductQty(scpq *StockChangeProductQty) (int64, error) { + return c.Create(StockChangeProductQtyModel, scpq) +} + +// UpdateStockChangeProductQty updates an existing stock.change.product.qty record. +func (c *Client) UpdateStockChangeProductQty(scpq *StockChangeProductQty) error { + return c.UpdateStockChangeProductQtys([]int64{scpq.Id.Get()}, scpq) +} + +// UpdateStockChangeProductQtys updates existing stock.change.product.qty records. +// All records (represented by ids) will be updated by scpq values. +func (c *Client) UpdateStockChangeProductQtys(ids []int64, scpq *StockChangeProductQty) error { + return c.Update(StockChangeProductQtyModel, ids, scpq) +} + +// DeleteStockChangeProductQty deletes an existing stock.change.product.qty record. +func (c *Client) DeleteStockChangeProductQty(id int64) error { + return c.DeleteStockChangeProductQtys([]int64{id}) +} + +// DeleteStockChangeProductQtys deletes existing stock.change.product.qty records. +func (c *Client) DeleteStockChangeProductQtys(ids []int64) error { + return c.Delete(StockChangeProductQtyModel, ids) +} + +// GetStockChangeProductQty gets stock.change.product.qty existing record. +func (c *Client) GetStockChangeProductQty(id int64) (*StockChangeProductQty, error) { + scpqs, err := c.GetStockChangeProductQtys([]int64{id}) + if err != nil { + return nil, err + } + if scpqs != nil && len(*scpqs) > 0 { + return &((*scpqs)[0]), nil + } + return nil, fmt.Errorf("id %v of stock.change.product.qty not found", id) +} + +// GetStockChangeProductQtys gets stock.change.product.qty existing records. +func (c *Client) GetStockChangeProductQtys(ids []int64) (*StockChangeProductQtys, error) { + scpqs := &StockChangeProductQtys{} + if err := c.Read(StockChangeProductQtyModel, ids, nil, scpqs); err != nil { + return nil, err + } + return scpqs, nil +} + +// FindStockChangeProductQty finds stock.change.product.qty record by querying it with criteria. +func (c *Client) FindStockChangeProductQty(criteria *Criteria) (*StockChangeProductQty, error) { + scpqs := &StockChangeProductQtys{} + if err := c.SearchRead(StockChangeProductQtyModel, criteria, NewOptions().Limit(1), scpqs); err != nil { + return nil, err + } + if scpqs != nil && len(*scpqs) > 0 { + return &((*scpqs)[0]), nil + } + return nil, fmt.Errorf("no stock.change.product.qty was found with criteria %v", criteria) +} + +// FindStockChangeProductQtys finds stock.change.product.qty records by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockChangeProductQtys(criteria *Criteria, options *Options) (*StockChangeProductQtys, error) { + scpqs := &StockChangeProductQtys{} + if err := c.SearchRead(StockChangeProductQtyModel, criteria, options, scpqs); err != nil { + return nil, err + } + return scpqs, nil +} + +// FindStockChangeProductQtyIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockChangeProductQtyIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(StockChangeProductQtyModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindStockChangeProductQtyId finds record id by querying it with criteria. +func (c *Client) FindStockChangeProductQtyId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(StockChangeProductQtyModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no stock.change.product.qty was found with criteria %v and options %v", criteria, options) +} diff --git a/stock_change_standard_price.go b/stock_change_standard_price.go new file mode 100644 index 00000000..c021ea8e --- /dev/null +++ b/stock_change_standard_price.go @@ -0,0 +1,121 @@ +package odoo + +import ( + "fmt" +) + +// StockChangeStandardPrice represents stock.change.standard.price model. +type StockChangeStandardPrice struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CounterpartAccountId *Many2One `xmlrpc:"counterpart_account_id,omitempty"` + CounterpartAccountIdRequired *Bool `xmlrpc:"counterpart_account_id_required,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + NewPrice *Float `xmlrpc:"new_price,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// StockChangeStandardPrices represents array of stock.change.standard.price model. +type StockChangeStandardPrices []StockChangeStandardPrice + +// StockChangeStandardPriceModel is the odoo model name. +const StockChangeStandardPriceModel = "stock.change.standard.price" + +// Many2One convert StockChangeStandardPrice to *Many2One. +func (scsp *StockChangeStandardPrice) Many2One() *Many2One { + return NewMany2One(scsp.Id.Get(), "") +} + +// CreateStockChangeStandardPrice creates a new stock.change.standard.price model and returns its id. +func (c *Client) CreateStockChangeStandardPrice(scsp *StockChangeStandardPrice) (int64, error) { + return c.Create(StockChangeStandardPriceModel, scsp) +} + +// UpdateStockChangeStandardPrice updates an existing stock.change.standard.price record. +func (c *Client) UpdateStockChangeStandardPrice(scsp *StockChangeStandardPrice) error { + return c.UpdateStockChangeStandardPrices([]int64{scsp.Id.Get()}, scsp) +} + +// UpdateStockChangeStandardPrices updates existing stock.change.standard.price records. +// All records (represented by ids) will be updated by scsp values. +func (c *Client) UpdateStockChangeStandardPrices(ids []int64, scsp *StockChangeStandardPrice) error { + return c.Update(StockChangeStandardPriceModel, ids, scsp) +} + +// DeleteStockChangeStandardPrice deletes an existing stock.change.standard.price record. +func (c *Client) DeleteStockChangeStandardPrice(id int64) error { + return c.DeleteStockChangeStandardPrices([]int64{id}) +} + +// DeleteStockChangeStandardPrices deletes existing stock.change.standard.price records. +func (c *Client) DeleteStockChangeStandardPrices(ids []int64) error { + return c.Delete(StockChangeStandardPriceModel, ids) +} + +// GetStockChangeStandardPrice gets stock.change.standard.price existing record. +func (c *Client) GetStockChangeStandardPrice(id int64) (*StockChangeStandardPrice, error) { + scsps, err := c.GetStockChangeStandardPrices([]int64{id}) + if err != nil { + return nil, err + } + if scsps != nil && len(*scsps) > 0 { + return &((*scsps)[0]), nil + } + return nil, fmt.Errorf("id %v of stock.change.standard.price not found", id) +} + +// GetStockChangeStandardPrices gets stock.change.standard.price existing records. +func (c *Client) GetStockChangeStandardPrices(ids []int64) (*StockChangeStandardPrices, error) { + scsps := &StockChangeStandardPrices{} + if err := c.Read(StockChangeStandardPriceModel, ids, nil, scsps); err != nil { + return nil, err + } + return scsps, nil +} + +// FindStockChangeStandardPrice finds stock.change.standard.price record by querying it with criteria. +func (c *Client) FindStockChangeStandardPrice(criteria *Criteria) (*StockChangeStandardPrice, error) { + scsps := &StockChangeStandardPrices{} + if err := c.SearchRead(StockChangeStandardPriceModel, criteria, NewOptions().Limit(1), scsps); err != nil { + return nil, err + } + if scsps != nil && len(*scsps) > 0 { + return &((*scsps)[0]), nil + } + return nil, fmt.Errorf("no stock.change.standard.price was found with criteria %v", criteria) +} + +// FindStockChangeStandardPrices finds stock.change.standard.price records by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockChangeStandardPrices(criteria *Criteria, options *Options) (*StockChangeStandardPrices, error) { + scsps := &StockChangeStandardPrices{} + if err := c.SearchRead(StockChangeStandardPriceModel, criteria, options, scsps); err != nil { + return nil, err + } + return scsps, nil +} + +// FindStockChangeStandardPriceIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockChangeStandardPriceIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(StockChangeStandardPriceModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindStockChangeStandardPriceId finds record id by querying it with criteria. +func (c *Client) FindStockChangeStandardPriceId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(StockChangeStandardPriceModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no stock.change.standard.price was found with criteria %v and options %v", criteria, options) +} diff --git a/stock_fixed_putaway_strat.go b/stock_fixed_putaway_strat.go new file mode 100644 index 00000000..26496cfe --- /dev/null +++ b/stock_fixed_putaway_strat.go @@ -0,0 +1,122 @@ +package odoo + +import ( + "fmt" +) + +// StockFixedPutawayStrat represents stock.fixed.putaway.strat model. +type StockFixedPutawayStrat struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CategoryId *Many2One `xmlrpc:"category_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + FixedLocationId *Many2One `xmlrpc:"fixed_location_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + PutawayId *Many2One `xmlrpc:"putaway_id,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// StockFixedPutawayStrats represents array of stock.fixed.putaway.strat model. +type StockFixedPutawayStrats []StockFixedPutawayStrat + +// StockFixedPutawayStratModel is the odoo model name. +const StockFixedPutawayStratModel = "stock.fixed.putaway.strat" + +// Many2One convert StockFixedPutawayStrat to *Many2One. +func (sfps *StockFixedPutawayStrat) Many2One() *Many2One { + return NewMany2One(sfps.Id.Get(), "") +} + +// CreateStockFixedPutawayStrat creates a new stock.fixed.putaway.strat model and returns its id. +func (c *Client) CreateStockFixedPutawayStrat(sfps *StockFixedPutawayStrat) (int64, error) { + return c.Create(StockFixedPutawayStratModel, sfps) +} + +// UpdateStockFixedPutawayStrat updates an existing stock.fixed.putaway.strat record. +func (c *Client) UpdateStockFixedPutawayStrat(sfps *StockFixedPutawayStrat) error { + return c.UpdateStockFixedPutawayStrats([]int64{sfps.Id.Get()}, sfps) +} + +// UpdateStockFixedPutawayStrats updates existing stock.fixed.putaway.strat records. +// All records (represented by ids) will be updated by sfps values. +func (c *Client) UpdateStockFixedPutawayStrats(ids []int64, sfps *StockFixedPutawayStrat) error { + return c.Update(StockFixedPutawayStratModel, ids, sfps) +} + +// DeleteStockFixedPutawayStrat deletes an existing stock.fixed.putaway.strat record. +func (c *Client) DeleteStockFixedPutawayStrat(id int64) error { + return c.DeleteStockFixedPutawayStrats([]int64{id}) +} + +// DeleteStockFixedPutawayStrats deletes existing stock.fixed.putaway.strat records. +func (c *Client) DeleteStockFixedPutawayStrats(ids []int64) error { + return c.Delete(StockFixedPutawayStratModel, ids) +} + +// GetStockFixedPutawayStrat gets stock.fixed.putaway.strat existing record. +func (c *Client) GetStockFixedPutawayStrat(id int64) (*StockFixedPutawayStrat, error) { + sfpss, err := c.GetStockFixedPutawayStrats([]int64{id}) + if err != nil { + return nil, err + } + if sfpss != nil && len(*sfpss) > 0 { + return &((*sfpss)[0]), nil + } + return nil, fmt.Errorf("id %v of stock.fixed.putaway.strat not found", id) +} + +// GetStockFixedPutawayStrats gets stock.fixed.putaway.strat existing records. +func (c *Client) GetStockFixedPutawayStrats(ids []int64) (*StockFixedPutawayStrats, error) { + sfpss := &StockFixedPutawayStrats{} + if err := c.Read(StockFixedPutawayStratModel, ids, nil, sfpss); err != nil { + return nil, err + } + return sfpss, nil +} + +// FindStockFixedPutawayStrat finds stock.fixed.putaway.strat record by querying it with criteria. +func (c *Client) FindStockFixedPutawayStrat(criteria *Criteria) (*StockFixedPutawayStrat, error) { + sfpss := &StockFixedPutawayStrats{} + if err := c.SearchRead(StockFixedPutawayStratModel, criteria, NewOptions().Limit(1), sfpss); err != nil { + return nil, err + } + if sfpss != nil && len(*sfpss) > 0 { + return &((*sfpss)[0]), nil + } + return nil, fmt.Errorf("no stock.fixed.putaway.strat was found with criteria %v", criteria) +} + +// FindStockFixedPutawayStrats finds stock.fixed.putaway.strat records by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockFixedPutawayStrats(criteria *Criteria, options *Options) (*StockFixedPutawayStrats, error) { + sfpss := &StockFixedPutawayStrats{} + if err := c.SearchRead(StockFixedPutawayStratModel, criteria, options, sfpss); err != nil { + return nil, err + } + return sfpss, nil +} + +// FindStockFixedPutawayStratIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockFixedPutawayStratIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(StockFixedPutawayStratModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindStockFixedPutawayStratId finds record id by querying it with criteria. +func (c *Client) FindStockFixedPutawayStratId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(StockFixedPutawayStratModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no stock.fixed.putaway.strat was found with criteria %v and options %v", criteria, options) +} diff --git a/stock_immediate_transfer.go b/stock_immediate_transfer.go new file mode 100644 index 00000000..6430ea60 --- /dev/null +++ b/stock_immediate_transfer.go @@ -0,0 +1,119 @@ +package odoo + +import ( + "fmt" +) + +// StockImmediateTransfer represents stock.immediate.transfer model. +type StockImmediateTransfer struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + PickIds *Relation `xmlrpc:"pick_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// StockImmediateTransfers represents array of stock.immediate.transfer model. +type StockImmediateTransfers []StockImmediateTransfer + +// StockImmediateTransferModel is the odoo model name. +const StockImmediateTransferModel = "stock.immediate.transfer" + +// Many2One convert StockImmediateTransfer to *Many2One. +func (sit *StockImmediateTransfer) Many2One() *Many2One { + return NewMany2One(sit.Id.Get(), "") +} + +// CreateStockImmediateTransfer creates a new stock.immediate.transfer model and returns its id. +func (c *Client) CreateStockImmediateTransfer(sit *StockImmediateTransfer) (int64, error) { + return c.Create(StockImmediateTransferModel, sit) +} + +// UpdateStockImmediateTransfer updates an existing stock.immediate.transfer record. +func (c *Client) UpdateStockImmediateTransfer(sit *StockImmediateTransfer) error { + return c.UpdateStockImmediateTransfers([]int64{sit.Id.Get()}, sit) +} + +// UpdateStockImmediateTransfers updates existing stock.immediate.transfer records. +// All records (represented by ids) will be updated by sit values. +func (c *Client) UpdateStockImmediateTransfers(ids []int64, sit *StockImmediateTransfer) error { + return c.Update(StockImmediateTransferModel, ids, sit) +} + +// DeleteStockImmediateTransfer deletes an existing stock.immediate.transfer record. +func (c *Client) DeleteStockImmediateTransfer(id int64) error { + return c.DeleteStockImmediateTransfers([]int64{id}) +} + +// DeleteStockImmediateTransfers deletes existing stock.immediate.transfer records. +func (c *Client) DeleteStockImmediateTransfers(ids []int64) error { + return c.Delete(StockImmediateTransferModel, ids) +} + +// GetStockImmediateTransfer gets stock.immediate.transfer existing record. +func (c *Client) GetStockImmediateTransfer(id int64) (*StockImmediateTransfer, error) { + sits, err := c.GetStockImmediateTransfers([]int64{id}) + if err != nil { + return nil, err + } + if sits != nil && len(*sits) > 0 { + return &((*sits)[0]), nil + } + return nil, fmt.Errorf("id %v of stock.immediate.transfer not found", id) +} + +// GetStockImmediateTransfers gets stock.immediate.transfer existing records. +func (c *Client) GetStockImmediateTransfers(ids []int64) (*StockImmediateTransfers, error) { + sits := &StockImmediateTransfers{} + if err := c.Read(StockImmediateTransferModel, ids, nil, sits); err != nil { + return nil, err + } + return sits, nil +} + +// FindStockImmediateTransfer finds stock.immediate.transfer record by querying it with criteria. +func (c *Client) FindStockImmediateTransfer(criteria *Criteria) (*StockImmediateTransfer, error) { + sits := &StockImmediateTransfers{} + if err := c.SearchRead(StockImmediateTransferModel, criteria, NewOptions().Limit(1), sits); err != nil { + return nil, err + } + if sits != nil && len(*sits) > 0 { + return &((*sits)[0]), nil + } + return nil, fmt.Errorf("no stock.immediate.transfer was found with criteria %v", criteria) +} + +// FindStockImmediateTransfers finds stock.immediate.transfer records by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockImmediateTransfers(criteria *Criteria, options *Options) (*StockImmediateTransfers, error) { + sits := &StockImmediateTransfers{} + if err := c.SearchRead(StockImmediateTransferModel, criteria, options, sits); err != nil { + return nil, err + } + return sits, nil +} + +// FindStockImmediateTransferIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockImmediateTransferIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(StockImmediateTransferModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindStockImmediateTransferId finds record id by querying it with criteria. +func (c *Client) FindStockImmediateTransferId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(StockImmediateTransferModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no stock.immediate.transfer was found with criteria %v and options %v", criteria, options) +} diff --git a/stock_incoterms.go b/stock_incoterms.go new file mode 100644 index 00000000..d6e7ce76 --- /dev/null +++ b/stock_incoterms.go @@ -0,0 +1,121 @@ +package odoo + +import ( + "fmt" +) + +// StockIncoterms represents stock.incoterms model. +type StockIncoterms struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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"` +} + +// StockIncotermss represents array of stock.incoterms model. +type StockIncotermss []StockIncoterms + +// StockIncotermsModel is the odoo model name. +const StockIncotermsModel = "stock.incoterms" + +// Many2One convert StockIncoterms to *Many2One. +func (si *StockIncoterms) Many2One() *Many2One { + return NewMany2One(si.Id.Get(), "") +} + +// CreateStockIncoterms creates a new stock.incoterms model and returns its id. +func (c *Client) CreateStockIncoterms(si *StockIncoterms) (int64, error) { + return c.Create(StockIncotermsModel, si) +} + +// UpdateStockIncoterms updates an existing stock.incoterms record. +func (c *Client) UpdateStockIncoterms(si *StockIncoterms) error { + return c.UpdateStockIncotermss([]int64{si.Id.Get()}, si) +} + +// UpdateStockIncotermss updates existing stock.incoterms records. +// All records (represented by ids) will be updated by si values. +func (c *Client) UpdateStockIncotermss(ids []int64, si *StockIncoterms) error { + return c.Update(StockIncotermsModel, ids, si) +} + +// DeleteStockIncoterms deletes an existing stock.incoterms record. +func (c *Client) DeleteStockIncoterms(id int64) error { + return c.DeleteStockIncotermss([]int64{id}) +} + +// DeleteStockIncotermss deletes existing stock.incoterms records. +func (c *Client) DeleteStockIncotermss(ids []int64) error { + return c.Delete(StockIncotermsModel, ids) +} + +// GetStockIncoterms gets stock.incoterms existing record. +func (c *Client) GetStockIncoterms(id int64) (*StockIncoterms, error) { + sis, err := c.GetStockIncotermss([]int64{id}) + if err != nil { + return nil, err + } + if sis != nil && len(*sis) > 0 { + return &((*sis)[0]), nil + } + return nil, fmt.Errorf("id %v of stock.incoterms not found", id) +} + +// GetStockIncotermss gets stock.incoterms existing records. +func (c *Client) GetStockIncotermss(ids []int64) (*StockIncotermss, error) { + sis := &StockIncotermss{} + if err := c.Read(StockIncotermsModel, ids, nil, sis); err != nil { + return nil, err + } + return sis, nil +} + +// FindStockIncoterms finds stock.incoterms record by querying it with criteria. +func (c *Client) FindStockIncoterms(criteria *Criteria) (*StockIncoterms, error) { + sis := &StockIncotermss{} + if err := c.SearchRead(StockIncotermsModel, criteria, NewOptions().Limit(1), sis); err != nil { + return nil, err + } + if sis != nil && len(*sis) > 0 { + return &((*sis)[0]), nil + } + return nil, fmt.Errorf("no stock.incoterms was found with criteria %v", criteria) +} + +// FindStockIncotermss finds stock.incoterms records by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockIncotermss(criteria *Criteria, options *Options) (*StockIncotermss, error) { + sis := &StockIncotermss{} + if err := c.SearchRead(StockIncotermsModel, criteria, options, sis); err != nil { + return nil, err + } + return sis, nil +} + +// FindStockIncotermsIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockIncotermsIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(StockIncotermsModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindStockIncotermsId finds record id by querying it with criteria. +func (c *Client) FindStockIncotermsId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(StockIncotermsModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no stock.incoterms was found with criteria %v and options %v", criteria, options) +} diff --git a/stock_inventory.go b/stock_inventory.go new file mode 100644 index 00000000..506a3b4b --- /dev/null +++ b/stock_inventory.go @@ -0,0 +1,134 @@ +package odoo + +import ( + "fmt" +) + +// StockInventory represents stock.inventory model. +type StockInventory struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AccountingDate *Time `xmlrpc:"accounting_date,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"` + Date *Time `xmlrpc:"date,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Exhausted *Bool `xmlrpc:"exhausted,omitempty"` + Filter *Selection `xmlrpc:"filter,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LineIds *Relation `xmlrpc:"line_ids,omitempty"` + LocationId *Many2One `xmlrpc:"location_id,omitempty"` + LotId *Many2One `xmlrpc:"lot_id,omitempty"` + MoveIds *Relation `xmlrpc:"move_ids,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + PackageId *Many2One `xmlrpc:"package_id,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + ProductId *Many2One `xmlrpc:"product_id,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + TotalQty *Float `xmlrpc:"total_qty,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// StockInventorys represents array of stock.inventory model. +type StockInventorys []StockInventory + +// StockInventoryModel is the odoo model name. +const StockInventoryModel = "stock.inventory" + +// Many2One convert StockInventory to *Many2One. +func (si *StockInventory) Many2One() *Many2One { + return NewMany2One(si.Id.Get(), "") +} + +// CreateStockInventory creates a new stock.inventory model and returns its id. +func (c *Client) CreateStockInventory(si *StockInventory) (int64, error) { + return c.Create(StockInventoryModel, si) +} + +// UpdateStockInventory updates an existing stock.inventory record. +func (c *Client) UpdateStockInventory(si *StockInventory) error { + return c.UpdateStockInventorys([]int64{si.Id.Get()}, si) +} + +// UpdateStockInventorys updates existing stock.inventory records. +// All records (represented by ids) will be updated by si values. +func (c *Client) UpdateStockInventorys(ids []int64, si *StockInventory) error { + return c.Update(StockInventoryModel, ids, si) +} + +// DeleteStockInventory deletes an existing stock.inventory record. +func (c *Client) DeleteStockInventory(id int64) error { + return c.DeleteStockInventorys([]int64{id}) +} + +// DeleteStockInventorys deletes existing stock.inventory records. +func (c *Client) DeleteStockInventorys(ids []int64) error { + return c.Delete(StockInventoryModel, ids) +} + +// GetStockInventory gets stock.inventory existing record. +func (c *Client) GetStockInventory(id int64) (*StockInventory, error) { + sis, err := c.GetStockInventorys([]int64{id}) + if err != nil { + return nil, err + } + if sis != nil && len(*sis) > 0 { + return &((*sis)[0]), nil + } + return nil, fmt.Errorf("id %v of stock.inventory not found", id) +} + +// GetStockInventorys gets stock.inventory existing records. +func (c *Client) GetStockInventorys(ids []int64) (*StockInventorys, error) { + sis := &StockInventorys{} + if err := c.Read(StockInventoryModel, ids, nil, sis); err != nil { + return nil, err + } + return sis, nil +} + +// FindStockInventory finds stock.inventory record by querying it with criteria. +func (c *Client) FindStockInventory(criteria *Criteria) (*StockInventory, error) { + sis := &StockInventorys{} + if err := c.SearchRead(StockInventoryModel, criteria, NewOptions().Limit(1), sis); err != nil { + return nil, err + } + if sis != nil && len(*sis) > 0 { + return &((*sis)[0]), nil + } + return nil, fmt.Errorf("no stock.inventory was found with criteria %v", criteria) +} + +// FindStockInventorys finds stock.inventory records by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockInventorys(criteria *Criteria, options *Options) (*StockInventorys, error) { + sis := &StockInventorys{} + if err := c.SearchRead(StockInventoryModel, criteria, options, sis); err != nil { + return nil, err + } + return sis, nil +} + +// FindStockInventoryIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockInventoryIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(StockInventoryModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindStockInventoryId finds record id by querying it with criteria. +func (c *Client) FindStockInventoryId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(StockInventoryModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no stock.inventory was found with criteria %v and options %v", criteria, options) +} diff --git a/stock_inventory_line.go b/stock_inventory_line.go new file mode 100644 index 00000000..aa2d468e --- /dev/null +++ b/stock_inventory_line.go @@ -0,0 +1,134 @@ +package odoo + +import ( + "fmt" +) + +// StockInventoryLine represents stock.inventory.line model. +type StockInventoryLine struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` + InventoryId *Many2One `xmlrpc:"inventory_id,omitempty"` + InventoryLocationId *Many2One `xmlrpc:"inventory_location_id,omitempty"` + LocationId *Many2One `xmlrpc:"location_id,omitempty"` + LocationName *String `xmlrpc:"location_name,omitempty"` + PackageId *Many2One `xmlrpc:"package_id,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + ProdLotId *Many2One `xmlrpc:"prod_lot_id,omitempty"` + ProdlotName *String `xmlrpc:"prodlot_name,omitempty"` + ProductCode *String `xmlrpc:"product_code,omitempty"` + ProductId *Many2One `xmlrpc:"product_id,omitempty"` + ProductName *String `xmlrpc:"product_name,omitempty"` + ProductQty *Float `xmlrpc:"product_qty,omitempty"` + ProductUomId *Many2One `xmlrpc:"product_uom_id,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + TheoreticalQty *Float `xmlrpc:"theoretical_qty,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// StockInventoryLines represents array of stock.inventory.line model. +type StockInventoryLines []StockInventoryLine + +// StockInventoryLineModel is the odoo model name. +const StockInventoryLineModel = "stock.inventory.line" + +// Many2One convert StockInventoryLine to *Many2One. +func (sil *StockInventoryLine) Many2One() *Many2One { + return NewMany2One(sil.Id.Get(), "") +} + +// CreateStockInventoryLine creates a new stock.inventory.line model and returns its id. +func (c *Client) CreateStockInventoryLine(sil *StockInventoryLine) (int64, error) { + return c.Create(StockInventoryLineModel, sil) +} + +// UpdateStockInventoryLine updates an existing stock.inventory.line record. +func (c *Client) UpdateStockInventoryLine(sil *StockInventoryLine) error { + return c.UpdateStockInventoryLines([]int64{sil.Id.Get()}, sil) +} + +// UpdateStockInventoryLines updates existing stock.inventory.line records. +// All records (represented by ids) will be updated by sil values. +func (c *Client) UpdateStockInventoryLines(ids []int64, sil *StockInventoryLine) error { + return c.Update(StockInventoryLineModel, ids, sil) +} + +// DeleteStockInventoryLine deletes an existing stock.inventory.line record. +func (c *Client) DeleteStockInventoryLine(id int64) error { + return c.DeleteStockInventoryLines([]int64{id}) +} + +// DeleteStockInventoryLines deletes existing stock.inventory.line records. +func (c *Client) DeleteStockInventoryLines(ids []int64) error { + return c.Delete(StockInventoryLineModel, ids) +} + +// GetStockInventoryLine gets stock.inventory.line existing record. +func (c *Client) GetStockInventoryLine(id int64) (*StockInventoryLine, error) { + sils, err := c.GetStockInventoryLines([]int64{id}) + if err != nil { + return nil, err + } + if sils != nil && len(*sils) > 0 { + return &((*sils)[0]), nil + } + return nil, fmt.Errorf("id %v of stock.inventory.line not found", id) +} + +// GetStockInventoryLines gets stock.inventory.line existing records. +func (c *Client) GetStockInventoryLines(ids []int64) (*StockInventoryLines, error) { + sils := &StockInventoryLines{} + if err := c.Read(StockInventoryLineModel, ids, nil, sils); err != nil { + return nil, err + } + return sils, nil +} + +// FindStockInventoryLine finds stock.inventory.line record by querying it with criteria. +func (c *Client) FindStockInventoryLine(criteria *Criteria) (*StockInventoryLine, error) { + sils := &StockInventoryLines{} + if err := c.SearchRead(StockInventoryLineModel, criteria, NewOptions().Limit(1), sils); err != nil { + return nil, err + } + if sils != nil && len(*sils) > 0 { + return &((*sils)[0]), nil + } + return nil, fmt.Errorf("no stock.inventory.line was found with criteria %v", criteria) +} + +// FindStockInventoryLines finds stock.inventory.line records by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockInventoryLines(criteria *Criteria, options *Options) (*StockInventoryLines, error) { + sils := &StockInventoryLines{} + if err := c.SearchRead(StockInventoryLineModel, criteria, options, sils); err != nil { + return nil, err + } + return sils, nil +} + +// FindStockInventoryLineIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockInventoryLineIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(StockInventoryLineModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindStockInventoryLineId finds record id by querying it with criteria. +func (c *Client) FindStockInventoryLineId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(StockInventoryLineModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no stock.inventory.line was found with criteria %v and options %v", criteria, options) +} diff --git a/stock_location.go b/stock_location.go new file mode 100644 index 00000000..06702798 --- /dev/null +++ b/stock_location.go @@ -0,0 +1,140 @@ +package odoo + +import ( + "fmt" +) + +// StockLocation represents stock.location model. +type StockLocation struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + Active *Bool `xmlrpc:"active,omitempty"` + Barcode *String `xmlrpc:"barcode,omitempty"` + ChildIds *Relation `xmlrpc:"child_ids,omitempty"` + Comment *String `xmlrpc:"comment,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"` + Id *Int `xmlrpc:"id,omitempty"` + LocationId *Many2One `xmlrpc:"location_id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + ParentLeft *Int `xmlrpc:"parent_left,omitempty"` + ParentRight *Int `xmlrpc:"parent_right,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + Posx *Int `xmlrpc:"posx,omitempty"` + Posy *Int `xmlrpc:"posy,omitempty"` + Posz *Int `xmlrpc:"posz,omitempty"` + PutawayStrategyId *Many2One `xmlrpc:"putaway_strategy_id,omitempty"` + QuantIds *Relation `xmlrpc:"quant_ids,omitempty"` + RemovalStrategyId *Many2One `xmlrpc:"removal_strategy_id,omitempty"` + ReturnLocation *Bool `xmlrpc:"return_location,omitempty"` + ScrapLocation *Bool `xmlrpc:"scrap_location,omitempty"` + Usage *Selection `xmlrpc:"usage,omitempty"` + ValuationInAccountId *Many2One `xmlrpc:"valuation_in_account_id,omitempty"` + ValuationOutAccountId *Many2One `xmlrpc:"valuation_out_account_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// StockLocations represents array of stock.location model. +type StockLocations []StockLocation + +// StockLocationModel is the odoo model name. +const StockLocationModel = "stock.location" + +// Many2One convert StockLocation to *Many2One. +func (sl *StockLocation) Many2One() *Many2One { + return NewMany2One(sl.Id.Get(), "") +} + +// CreateStockLocation creates a new stock.location model and returns its id. +func (c *Client) CreateStockLocation(sl *StockLocation) (int64, error) { + return c.Create(StockLocationModel, sl) +} + +// UpdateStockLocation updates an existing stock.location record. +func (c *Client) UpdateStockLocation(sl *StockLocation) error { + return c.UpdateStockLocations([]int64{sl.Id.Get()}, sl) +} + +// UpdateStockLocations updates existing stock.location records. +// All records (represented by ids) will be updated by sl values. +func (c *Client) UpdateStockLocations(ids []int64, sl *StockLocation) error { + return c.Update(StockLocationModel, ids, sl) +} + +// DeleteStockLocation deletes an existing stock.location record. +func (c *Client) DeleteStockLocation(id int64) error { + return c.DeleteStockLocations([]int64{id}) +} + +// DeleteStockLocations deletes existing stock.location records. +func (c *Client) DeleteStockLocations(ids []int64) error { + return c.Delete(StockLocationModel, ids) +} + +// GetStockLocation gets stock.location existing record. +func (c *Client) GetStockLocation(id int64) (*StockLocation, error) { + sls, err := c.GetStockLocations([]int64{id}) + if err != nil { + return nil, err + } + if sls != nil && len(*sls) > 0 { + return &((*sls)[0]), nil + } + return nil, fmt.Errorf("id %v of stock.location not found", id) +} + +// GetStockLocations gets stock.location existing records. +func (c *Client) GetStockLocations(ids []int64) (*StockLocations, error) { + sls := &StockLocations{} + if err := c.Read(StockLocationModel, ids, nil, sls); err != nil { + return nil, err + } + return sls, nil +} + +// FindStockLocation finds stock.location record by querying it with criteria. +func (c *Client) FindStockLocation(criteria *Criteria) (*StockLocation, error) { + sls := &StockLocations{} + if err := c.SearchRead(StockLocationModel, criteria, NewOptions().Limit(1), sls); err != nil { + return nil, err + } + if sls != nil && len(*sls) > 0 { + return &((*sls)[0]), nil + } + return nil, fmt.Errorf("no stock.location was found with criteria %v", criteria) +} + +// FindStockLocations finds stock.location records by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockLocations(criteria *Criteria, options *Options) (*StockLocations, error) { + sls := &StockLocations{} + if err := c.SearchRead(StockLocationModel, criteria, options, sls); err != nil { + return nil, err + } + return sls, nil +} + +// FindStockLocationIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockLocationIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(StockLocationModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindStockLocationId finds record id by querying it with criteria. +func (c *Client) FindStockLocationId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(StockLocationModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no stock.location was found with criteria %v and options %v", criteria, options) +} diff --git a/stock_location_path.go b/stock_location_path.go new file mode 100644 index 00000000..ff40feef --- /dev/null +++ b/stock_location_path.go @@ -0,0 +1,131 @@ +package odoo + +import ( + "fmt" +) + +// StockLocationPath represents stock.location.path model. +type StockLocationPath struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + Active *Bool `xmlrpc:"active,omitempty"` + Auto *Selection `xmlrpc:"auto,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Delay *Int `xmlrpc:"delay,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LocationDestId *Many2One `xmlrpc:"location_dest_id,omitempty"` + LocationFromId *Many2One `xmlrpc:"location_from_id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + PickingTypeId *Many2One `xmlrpc:"picking_type_id,omitempty"` + Propagate *Bool `xmlrpc:"propagate,omitempty"` + RouteId *Many2One `xmlrpc:"route_id,omitempty"` + RouteSequence *Int `xmlrpc:"route_sequence,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + WarehouseId *Many2One `xmlrpc:"warehouse_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// StockLocationPaths represents array of stock.location.path model. +type StockLocationPaths []StockLocationPath + +// StockLocationPathModel is the odoo model name. +const StockLocationPathModel = "stock.location.path" + +// Many2One convert StockLocationPath to *Many2One. +func (slp *StockLocationPath) Many2One() *Many2One { + return NewMany2One(slp.Id.Get(), "") +} + +// CreateStockLocationPath creates a new stock.location.path model and returns its id. +func (c *Client) CreateStockLocationPath(slp *StockLocationPath) (int64, error) { + return c.Create(StockLocationPathModel, slp) +} + +// UpdateStockLocationPath updates an existing stock.location.path record. +func (c *Client) UpdateStockLocationPath(slp *StockLocationPath) error { + return c.UpdateStockLocationPaths([]int64{slp.Id.Get()}, slp) +} + +// UpdateStockLocationPaths updates existing stock.location.path records. +// All records (represented by ids) will be updated by slp values. +func (c *Client) UpdateStockLocationPaths(ids []int64, slp *StockLocationPath) error { + return c.Update(StockLocationPathModel, ids, slp) +} + +// DeleteStockLocationPath deletes an existing stock.location.path record. +func (c *Client) DeleteStockLocationPath(id int64) error { + return c.DeleteStockLocationPaths([]int64{id}) +} + +// DeleteStockLocationPaths deletes existing stock.location.path records. +func (c *Client) DeleteStockLocationPaths(ids []int64) error { + return c.Delete(StockLocationPathModel, ids) +} + +// GetStockLocationPath gets stock.location.path existing record. +func (c *Client) GetStockLocationPath(id int64) (*StockLocationPath, error) { + slps, err := c.GetStockLocationPaths([]int64{id}) + if err != nil { + return nil, err + } + if slps != nil && len(*slps) > 0 { + return &((*slps)[0]), nil + } + return nil, fmt.Errorf("id %v of stock.location.path not found", id) +} + +// GetStockLocationPaths gets stock.location.path existing records. +func (c *Client) GetStockLocationPaths(ids []int64) (*StockLocationPaths, error) { + slps := &StockLocationPaths{} + if err := c.Read(StockLocationPathModel, ids, nil, slps); err != nil { + return nil, err + } + return slps, nil +} + +// FindStockLocationPath finds stock.location.path record by querying it with criteria. +func (c *Client) FindStockLocationPath(criteria *Criteria) (*StockLocationPath, error) { + slps := &StockLocationPaths{} + if err := c.SearchRead(StockLocationPathModel, criteria, NewOptions().Limit(1), slps); err != nil { + return nil, err + } + if slps != nil && len(*slps) > 0 { + return &((*slps)[0]), nil + } + return nil, fmt.Errorf("no stock.location.path was found with criteria %v", criteria) +} + +// FindStockLocationPaths finds stock.location.path records by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockLocationPaths(criteria *Criteria, options *Options) (*StockLocationPaths, error) { + slps := &StockLocationPaths{} + if err := c.SearchRead(StockLocationPathModel, criteria, options, slps); err != nil { + return nil, err + } + return slps, nil +} + +// FindStockLocationPathIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockLocationPathIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(StockLocationPathModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindStockLocationPathId finds record id by querying it with criteria. +func (c *Client) FindStockLocationPathId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(StockLocationPathModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no stock.location.path was found with criteria %v and options %v", criteria, options) +} diff --git a/stock_location_route.go b/stock_location_route.go new file mode 100644 index 00000000..7229b0dc --- /dev/null +++ b/stock_location_route.go @@ -0,0 +1,133 @@ +package odoo + +import ( + "fmt" +) + +// StockLocationRoute represents stock.location.route model. +type StockLocationRoute struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + Active *Bool `xmlrpc:"active,omitempty"` + CategIds *Relation `xmlrpc:"categ_ids,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"` + ProductCategSelectable *Bool `xmlrpc:"product_categ_selectable,omitempty"` + ProductIds *Relation `xmlrpc:"product_ids,omitempty"` + ProductSelectable *Bool `xmlrpc:"product_selectable,omitempty"` + PullIds *Relation `xmlrpc:"pull_ids,omitempty"` + PushIds *Relation `xmlrpc:"push_ids,omitempty"` + SaleSelectable *Bool `xmlrpc:"sale_selectable,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + SuppliedWhId *Many2One `xmlrpc:"supplied_wh_id,omitempty"` + SupplierWhId *Many2One `xmlrpc:"supplier_wh_id,omitempty"` + WarehouseIds *Relation `xmlrpc:"warehouse_ids,omitempty"` + WarehouseSelectable *Bool `xmlrpc:"warehouse_selectable,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// StockLocationRoutes represents array of stock.location.route model. +type StockLocationRoutes []StockLocationRoute + +// StockLocationRouteModel is the odoo model name. +const StockLocationRouteModel = "stock.location.route" + +// Many2One convert StockLocationRoute to *Many2One. +func (slr *StockLocationRoute) Many2One() *Many2One { + return NewMany2One(slr.Id.Get(), "") +} + +// CreateStockLocationRoute creates a new stock.location.route model and returns its id. +func (c *Client) CreateStockLocationRoute(slr *StockLocationRoute) (int64, error) { + return c.Create(StockLocationRouteModel, slr) +} + +// UpdateStockLocationRoute updates an existing stock.location.route record. +func (c *Client) UpdateStockLocationRoute(slr *StockLocationRoute) error { + return c.UpdateStockLocationRoutes([]int64{slr.Id.Get()}, slr) +} + +// UpdateStockLocationRoutes updates existing stock.location.route records. +// All records (represented by ids) will be updated by slr values. +func (c *Client) UpdateStockLocationRoutes(ids []int64, slr *StockLocationRoute) error { + return c.Update(StockLocationRouteModel, ids, slr) +} + +// DeleteStockLocationRoute deletes an existing stock.location.route record. +func (c *Client) DeleteStockLocationRoute(id int64) error { + return c.DeleteStockLocationRoutes([]int64{id}) +} + +// DeleteStockLocationRoutes deletes existing stock.location.route records. +func (c *Client) DeleteStockLocationRoutes(ids []int64) error { + return c.Delete(StockLocationRouteModel, ids) +} + +// GetStockLocationRoute gets stock.location.route existing record. +func (c *Client) GetStockLocationRoute(id int64) (*StockLocationRoute, error) { + slrs, err := c.GetStockLocationRoutes([]int64{id}) + if err != nil { + return nil, err + } + if slrs != nil && len(*slrs) > 0 { + return &((*slrs)[0]), nil + } + return nil, fmt.Errorf("id %v of stock.location.route not found", id) +} + +// GetStockLocationRoutes gets stock.location.route existing records. +func (c *Client) GetStockLocationRoutes(ids []int64) (*StockLocationRoutes, error) { + slrs := &StockLocationRoutes{} + if err := c.Read(StockLocationRouteModel, ids, nil, slrs); err != nil { + return nil, err + } + return slrs, nil +} + +// FindStockLocationRoute finds stock.location.route record by querying it with criteria. +func (c *Client) FindStockLocationRoute(criteria *Criteria) (*StockLocationRoute, error) { + slrs := &StockLocationRoutes{} + if err := c.SearchRead(StockLocationRouteModel, criteria, NewOptions().Limit(1), slrs); err != nil { + return nil, err + } + if slrs != nil && len(*slrs) > 0 { + return &((*slrs)[0]), nil + } + return nil, fmt.Errorf("no stock.location.route was found with criteria %v", criteria) +} + +// FindStockLocationRoutes finds stock.location.route records by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockLocationRoutes(criteria *Criteria, options *Options) (*StockLocationRoutes, error) { + slrs := &StockLocationRoutes{} + if err := c.SearchRead(StockLocationRouteModel, criteria, options, slrs); err != nil { + return nil, err + } + return slrs, nil +} + +// FindStockLocationRouteIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockLocationRouteIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(StockLocationRouteModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindStockLocationRouteId finds record id by querying it with criteria. +func (c *Client) FindStockLocationRouteId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(StockLocationRouteModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no stock.location.route was found with criteria %v and options %v", criteria, options) +} diff --git a/stock_move.go b/stock_move.go new file mode 100644 index 00000000..fb635a65 --- /dev/null +++ b/stock_move.go @@ -0,0 +1,183 @@ +package odoo + +import ( + "fmt" +) + +// StockMove represents stock.move model. +type StockMove struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AccountMoveIds *Relation `xmlrpc:"account_move_ids,omitempty"` + Additional *Bool `xmlrpc:"additional,omitempty"` + Availability *Float `xmlrpc:"availability,omitempty"` + BackorderId *Many2One `xmlrpc:"backorder_id,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CreatedPurchaseLineId *Many2One `xmlrpc:"created_purchase_line_id,omitempty"` + Date *Time `xmlrpc:"date,omitempty"` + DateExpected *Time `xmlrpc:"date_expected,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + GroupId *Many2One `xmlrpc:"group_id,omitempty"` + HasMoveLines *Bool `xmlrpc:"has_move_lines,omitempty"` + HasTracking *Selection `xmlrpc:"has_tracking,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + InventoryId *Many2One `xmlrpc:"inventory_id,omitempty"` + IsInitialDemandEditable *Bool `xmlrpc:"is_initial_demand_editable,omitempty"` + IsLocked *Bool `xmlrpc:"is_locked,omitempty"` + IsQuantityDoneEditable *Bool `xmlrpc:"is_quantity_done_editable,omitempty"` + LocationDestId *Many2One `xmlrpc:"location_dest_id,omitempty"` + LocationId *Many2One `xmlrpc:"location_id,omitempty"` + MoveDestIds *Relation `xmlrpc:"move_dest_ids,omitempty"` + MoveLineIds *Relation `xmlrpc:"move_line_ids,omitempty"` + MoveLineNosuggestIds *Relation `xmlrpc:"move_line_nosuggest_ids,omitempty"` + MoveOrigIds *Relation `xmlrpc:"move_orig_ids,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Note *String `xmlrpc:"note,omitempty"` + OrderedQty *Float `xmlrpc:"ordered_qty,omitempty"` + Origin *String `xmlrpc:"origin,omitempty"` + OriginReturnedMoveId *Many2One `xmlrpc:"origin_returned_move_id,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PickingCode *Selection `xmlrpc:"picking_code,omitempty"` + PickingId *Many2One `xmlrpc:"picking_id,omitempty"` + PickingPartnerId *Many2One `xmlrpc:"picking_partner_id,omitempty"` + PickingTypeId *Many2One `xmlrpc:"picking_type_id,omitempty"` + PriceUnit *Float `xmlrpc:"price_unit,omitempty"` + Priority *Selection `xmlrpc:"priority,omitempty"` + ProcureMethod *Selection `xmlrpc:"procure_method,omitempty"` + ProductId *Many2One `xmlrpc:"product_id,omitempty"` + ProductPackaging *Many2One `xmlrpc:"product_packaging,omitempty"` + ProductQty *Float `xmlrpc:"product_qty,omitempty"` + ProductTmplId *Many2One `xmlrpc:"product_tmpl_id,omitempty"` + ProductType *Selection `xmlrpc:"product_type,omitempty"` + ProductUom *Many2One `xmlrpc:"product_uom,omitempty"` + ProductUomQty *Float `xmlrpc:"product_uom_qty,omitempty"` + Propagate *Bool `xmlrpc:"propagate,omitempty"` + PurchaseLineId *Many2One `xmlrpc:"purchase_line_id,omitempty"` + PushRuleId *Many2One `xmlrpc:"push_rule_id,omitempty"` + QuantityDone *Float `xmlrpc:"quantity_done,omitempty"` + Reference *String `xmlrpc:"reference,omitempty"` + RemainingQty *Float `xmlrpc:"remaining_qty,omitempty"` + RemainingValue *Float `xmlrpc:"remaining_value,omitempty"` + ReservedAvailability *Float `xmlrpc:"reserved_availability,omitempty"` + RestrictPartnerId *Many2One `xmlrpc:"restrict_partner_id,omitempty"` + ReturnedMoveIds *Relation `xmlrpc:"returned_move_ids,omitempty"` + RouteIds *Relation `xmlrpc:"route_ids,omitempty"` + RuleId *Many2One `xmlrpc:"rule_id,omitempty"` + SaleLineId *Many2One `xmlrpc:"sale_line_id,omitempty"` + ScrapIds *Relation `xmlrpc:"scrap_ids,omitempty"` + Scrapped *Bool `xmlrpc:"scrapped,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + ShowDetailsVisible *Bool `xmlrpc:"show_details_visible,omitempty"` + ShowOperations *Bool `xmlrpc:"show_operations,omitempty"` + ShowReservedAvailability *Bool `xmlrpc:"show_reserved_availability,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + StringAvailabilityInfo *String `xmlrpc:"string_availability_info,omitempty"` + ToRefund *Bool `xmlrpc:"to_refund,omitempty"` + Value *Float `xmlrpc:"value,omitempty"` + WarehouseId *Many2One `xmlrpc:"warehouse_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// StockMoves represents array of stock.move model. +type StockMoves []StockMove + +// StockMoveModel is the odoo model name. +const StockMoveModel = "stock.move" + +// Many2One convert StockMove to *Many2One. +func (sm *StockMove) Many2One() *Many2One { + return NewMany2One(sm.Id.Get(), "") +} + +// CreateStockMove creates a new stock.move model and returns its id. +func (c *Client) CreateStockMove(sm *StockMove) (int64, error) { + return c.Create(StockMoveModel, sm) +} + +// UpdateStockMove updates an existing stock.move record. +func (c *Client) UpdateStockMove(sm *StockMove) error { + return c.UpdateStockMoves([]int64{sm.Id.Get()}, sm) +} + +// UpdateStockMoves updates existing stock.move records. +// All records (represented by ids) will be updated by sm values. +func (c *Client) UpdateStockMoves(ids []int64, sm *StockMove) error { + return c.Update(StockMoveModel, ids, sm) +} + +// DeleteStockMove deletes an existing stock.move record. +func (c *Client) DeleteStockMove(id int64) error { + return c.DeleteStockMoves([]int64{id}) +} + +// DeleteStockMoves deletes existing stock.move records. +func (c *Client) DeleteStockMoves(ids []int64) error { + return c.Delete(StockMoveModel, ids) +} + +// GetStockMove gets stock.move existing record. +func (c *Client) GetStockMove(id int64) (*StockMove, error) { + sms, err := c.GetStockMoves([]int64{id}) + if err != nil { + return nil, err + } + if sms != nil && len(*sms) > 0 { + return &((*sms)[0]), nil + } + return nil, fmt.Errorf("id %v of stock.move not found", id) +} + +// GetStockMoves gets stock.move existing records. +func (c *Client) GetStockMoves(ids []int64) (*StockMoves, error) { + sms := &StockMoves{} + if err := c.Read(StockMoveModel, ids, nil, sms); err != nil { + return nil, err + } + return sms, nil +} + +// FindStockMove finds stock.move record by querying it with criteria. +func (c *Client) FindStockMove(criteria *Criteria) (*StockMove, error) { + sms := &StockMoves{} + if err := c.SearchRead(StockMoveModel, criteria, NewOptions().Limit(1), sms); err != nil { + return nil, err + } + if sms != nil && len(*sms) > 0 { + return &((*sms)[0]), nil + } + return nil, fmt.Errorf("no stock.move was found with criteria %v", criteria) +} + +// FindStockMoves finds stock.move records by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockMoves(criteria *Criteria, options *Options) (*StockMoves, error) { + sms := &StockMoves{} + if err := c.SearchRead(StockMoveModel, criteria, options, sms); err != nil { + return nil, err + } + return sms, nil +} + +// FindStockMoveIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockMoveIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(StockMoveModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindStockMoveId finds record id by querying it with criteria. +func (c *Client) FindStockMoveId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(StockMoveModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no stock.move was found with criteria %v and options %v", criteria, options) +} diff --git a/stock_move_line.go b/stock_move_line.go new file mode 100644 index 00000000..75e7e5cc --- /dev/null +++ b/stock_move_line.go @@ -0,0 +1,144 @@ +package odoo + +import ( + "fmt" +) + +// StockMoveLine represents stock.move.line model. +type StockMoveLine struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + ConsumeLineIds *Relation `xmlrpc:"consume_line_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"` + FromLoc *String `xmlrpc:"from_loc,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + InEntirePackage *Bool `xmlrpc:"in_entire_package,omitempty"` + IsInitialDemandEditable *Bool `xmlrpc:"is_initial_demand_editable,omitempty"` + IsLocked *Bool `xmlrpc:"is_locked,omitempty"` + LocationDestId *Many2One `xmlrpc:"location_dest_id,omitempty"` + LocationId *Many2One `xmlrpc:"location_id,omitempty"` + LotId *Many2One `xmlrpc:"lot_id,omitempty"` + LotName *String `xmlrpc:"lot_name,omitempty"` + LotsVisible *Bool `xmlrpc:"lots_visible,omitempty"` + MoveId *Many2One `xmlrpc:"move_id,omitempty"` + OrderedQty *Float `xmlrpc:"ordered_qty,omitempty"` + OwnerId *Many2One `xmlrpc:"owner_id,omitempty"` + PackageId *Many2One `xmlrpc:"package_id,omitempty"` + PickingId *Many2One `xmlrpc:"picking_id,omitempty"` + ProduceLineIds *Relation `xmlrpc:"produce_line_ids,omitempty"` + ProductId *Many2One `xmlrpc:"product_id,omitempty"` + ProductQty *Float `xmlrpc:"product_qty,omitempty"` + ProductUomId *Many2One `xmlrpc:"product_uom_id,omitempty"` + ProductUomQty *Float `xmlrpc:"product_uom_qty,omitempty"` + QtyDone *Float `xmlrpc:"qty_done,omitempty"` + Reference *String `xmlrpc:"reference,omitempty"` + ResultPackageId *Many2One `xmlrpc:"result_package_id,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + ToLoc *String `xmlrpc:"to_loc,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// StockMoveLines represents array of stock.move.line model. +type StockMoveLines []StockMoveLine + +// StockMoveLineModel is the odoo model name. +const StockMoveLineModel = "stock.move.line" + +// Many2One convert StockMoveLine to *Many2One. +func (sml *StockMoveLine) Many2One() *Many2One { + return NewMany2One(sml.Id.Get(), "") +} + +// CreateStockMoveLine creates a new stock.move.line model and returns its id. +func (c *Client) CreateStockMoveLine(sml *StockMoveLine) (int64, error) { + return c.Create(StockMoveLineModel, sml) +} + +// UpdateStockMoveLine updates an existing stock.move.line record. +func (c *Client) UpdateStockMoveLine(sml *StockMoveLine) error { + return c.UpdateStockMoveLines([]int64{sml.Id.Get()}, sml) +} + +// UpdateStockMoveLines updates existing stock.move.line records. +// All records (represented by ids) will be updated by sml values. +func (c *Client) UpdateStockMoveLines(ids []int64, sml *StockMoveLine) error { + return c.Update(StockMoveLineModel, ids, sml) +} + +// DeleteStockMoveLine deletes an existing stock.move.line record. +func (c *Client) DeleteStockMoveLine(id int64) error { + return c.DeleteStockMoveLines([]int64{id}) +} + +// DeleteStockMoveLines deletes existing stock.move.line records. +func (c *Client) DeleteStockMoveLines(ids []int64) error { + return c.Delete(StockMoveLineModel, ids) +} + +// GetStockMoveLine gets stock.move.line existing record. +func (c *Client) GetStockMoveLine(id int64) (*StockMoveLine, error) { + smls, err := c.GetStockMoveLines([]int64{id}) + if err != nil { + return nil, err + } + if smls != nil && len(*smls) > 0 { + return &((*smls)[0]), nil + } + return nil, fmt.Errorf("id %v of stock.move.line not found", id) +} + +// GetStockMoveLines gets stock.move.line existing records. +func (c *Client) GetStockMoveLines(ids []int64) (*StockMoveLines, error) { + smls := &StockMoveLines{} + if err := c.Read(StockMoveLineModel, ids, nil, smls); err != nil { + return nil, err + } + return smls, nil +} + +// FindStockMoveLine finds stock.move.line record by querying it with criteria. +func (c *Client) FindStockMoveLine(criteria *Criteria) (*StockMoveLine, error) { + smls := &StockMoveLines{} + if err := c.SearchRead(StockMoveLineModel, criteria, NewOptions().Limit(1), smls); err != nil { + return nil, err + } + if smls != nil && len(*smls) > 0 { + return &((*smls)[0]), nil + } + return nil, fmt.Errorf("no stock.move.line was found with criteria %v", criteria) +} + +// FindStockMoveLines finds stock.move.line records by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockMoveLines(criteria *Criteria, options *Options) (*StockMoveLines, error) { + smls := &StockMoveLines{} + if err := c.SearchRead(StockMoveLineModel, criteria, options, smls); err != nil { + return nil, err + } + return smls, nil +} + +// FindStockMoveLineIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockMoveLineIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(StockMoveLineModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindStockMoveLineId finds record id by querying it with criteria. +func (c *Client) FindStockMoveLineId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(StockMoveLineModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no stock.move.line was found with criteria %v and options %v", criteria, options) +} diff --git a/stock_overprocessed_transfer.go b/stock_overprocessed_transfer.go new file mode 100644 index 00000000..1b5bd335 --- /dev/null +++ b/stock_overprocessed_transfer.go @@ -0,0 +1,120 @@ +package odoo + +import ( + "fmt" +) + +// StockOverprocessedTransfer represents stock.overprocessed.transfer model. +type StockOverprocessedTransfer struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + OverprocessedProductName *String `xmlrpc:"overprocessed_product_name,omitempty"` + PickingId *Many2One `xmlrpc:"picking_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// StockOverprocessedTransfers represents array of stock.overprocessed.transfer model. +type StockOverprocessedTransfers []StockOverprocessedTransfer + +// StockOverprocessedTransferModel is the odoo model name. +const StockOverprocessedTransferModel = "stock.overprocessed.transfer" + +// Many2One convert StockOverprocessedTransfer to *Many2One. +func (sot *StockOverprocessedTransfer) Many2One() *Many2One { + return NewMany2One(sot.Id.Get(), "") +} + +// CreateStockOverprocessedTransfer creates a new stock.overprocessed.transfer model and returns its id. +func (c *Client) CreateStockOverprocessedTransfer(sot *StockOverprocessedTransfer) (int64, error) { + return c.Create(StockOverprocessedTransferModel, sot) +} + +// UpdateStockOverprocessedTransfer updates an existing stock.overprocessed.transfer record. +func (c *Client) UpdateStockOverprocessedTransfer(sot *StockOverprocessedTransfer) error { + return c.UpdateStockOverprocessedTransfers([]int64{sot.Id.Get()}, sot) +} + +// UpdateStockOverprocessedTransfers updates existing stock.overprocessed.transfer records. +// All records (represented by ids) will be updated by sot values. +func (c *Client) UpdateStockOverprocessedTransfers(ids []int64, sot *StockOverprocessedTransfer) error { + return c.Update(StockOverprocessedTransferModel, ids, sot) +} + +// DeleteStockOverprocessedTransfer deletes an existing stock.overprocessed.transfer record. +func (c *Client) DeleteStockOverprocessedTransfer(id int64) error { + return c.DeleteStockOverprocessedTransfers([]int64{id}) +} + +// DeleteStockOverprocessedTransfers deletes existing stock.overprocessed.transfer records. +func (c *Client) DeleteStockOverprocessedTransfers(ids []int64) error { + return c.Delete(StockOverprocessedTransferModel, ids) +} + +// GetStockOverprocessedTransfer gets stock.overprocessed.transfer existing record. +func (c *Client) GetStockOverprocessedTransfer(id int64) (*StockOverprocessedTransfer, error) { + sots, err := c.GetStockOverprocessedTransfers([]int64{id}) + if err != nil { + return nil, err + } + if sots != nil && len(*sots) > 0 { + return &((*sots)[0]), nil + } + return nil, fmt.Errorf("id %v of stock.overprocessed.transfer not found", id) +} + +// GetStockOverprocessedTransfers gets stock.overprocessed.transfer existing records. +func (c *Client) GetStockOverprocessedTransfers(ids []int64) (*StockOverprocessedTransfers, error) { + sots := &StockOverprocessedTransfers{} + if err := c.Read(StockOverprocessedTransferModel, ids, nil, sots); err != nil { + return nil, err + } + return sots, nil +} + +// FindStockOverprocessedTransfer finds stock.overprocessed.transfer record by querying it with criteria. +func (c *Client) FindStockOverprocessedTransfer(criteria *Criteria) (*StockOverprocessedTransfer, error) { + sots := &StockOverprocessedTransfers{} + if err := c.SearchRead(StockOverprocessedTransferModel, criteria, NewOptions().Limit(1), sots); err != nil { + return nil, err + } + if sots != nil && len(*sots) > 0 { + return &((*sots)[0]), nil + } + return nil, fmt.Errorf("no stock.overprocessed.transfer was found with criteria %v", criteria) +} + +// FindStockOverprocessedTransfers finds stock.overprocessed.transfer records by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockOverprocessedTransfers(criteria *Criteria, options *Options) (*StockOverprocessedTransfers, error) { + sots := &StockOverprocessedTransfers{} + if err := c.SearchRead(StockOverprocessedTransferModel, criteria, options, sots); err != nil { + return nil, err + } + return sots, nil +} + +// FindStockOverprocessedTransferIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockOverprocessedTransferIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(StockOverprocessedTransferModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindStockOverprocessedTransferId finds record id by querying it with criteria. +func (c *Client) FindStockOverprocessedTransferId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(StockOverprocessedTransferModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no stock.overprocessed.transfer was found with criteria %v and options %v", criteria, options) +} diff --git a/stock_picking.go b/stock_picking.go new file mode 100644 index 00000000..de8061c1 --- /dev/null +++ b/stock_picking.go @@ -0,0 +1,172 @@ +package odoo + +import ( + "fmt" +) + +// StockPicking represents stock.picking model. +type StockPicking struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + ActivityDateDeadline *Time `xmlrpc:"activity_date_deadline,omitempty"` + ActivityIds *Relation `xmlrpc:"activity_ids,omitempty"` + ActivityState *Selection `xmlrpc:"activity_state,omitempty"` + ActivitySummary *String `xmlrpc:"activity_summary,omitempty"` + ActivityTypeId *Many2One `xmlrpc:"activity_type_id,omitempty"` + ActivityUserId *Many2One `xmlrpc:"activity_user_id,omitempty"` + BackorderId *Many2One `xmlrpc:"backorder_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"` + DateDone *Time `xmlrpc:"date_done,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + EntirePackageDetailIds *Relation `xmlrpc:"entire_package_detail_ids,omitempty"` + EntirePackageIds *Relation `xmlrpc:"entire_package_ids,omitempty"` + GroupId *Many2One `xmlrpc:"group_id,omitempty"` + HasPackages *Bool `xmlrpc:"has_packages,omitempty"` + HasScrapMove *Bool `xmlrpc:"has_scrap_move,omitempty"` + HasTracking *Bool `xmlrpc:"has_tracking,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsLocked *Bool `xmlrpc:"is_locked,omitempty"` + LocationDestId *Many2One `xmlrpc:"location_dest_id,omitempty"` + LocationId *Many2One `xmlrpc:"location_id,omitempty"` + MessageChannelIds *Relation `xmlrpc:"message_channel_ids,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageLastPost *Time `xmlrpc:"message_last_post,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MessageUnread *Bool `xmlrpc:"message_unread,omitempty"` + MessageUnreadCounter *Int `xmlrpc:"message_unread_counter,omitempty"` + MoveLineExist *Bool `xmlrpc:"move_line_exist,omitempty"` + MoveLineIds *Relation `xmlrpc:"move_line_ids,omitempty"` + MoveLines *Relation `xmlrpc:"move_lines,omitempty"` + MoveType *Selection `xmlrpc:"move_type,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Note *String `xmlrpc:"note,omitempty"` + Origin *String `xmlrpc:"origin,omitempty"` + OwnerId *Many2One `xmlrpc:"owner_id,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PickingTypeCode *Selection `xmlrpc:"picking_type_code,omitempty"` + PickingTypeEntirePacks *Bool `xmlrpc:"picking_type_entire_packs,omitempty"` + PickingTypeId *Many2One `xmlrpc:"picking_type_id,omitempty"` + Printed *Bool `xmlrpc:"printed,omitempty"` + Priority *Selection `xmlrpc:"priority,omitempty"` + ProductId *Many2One `xmlrpc:"product_id,omitempty"` + PurchaseId *Many2One `xmlrpc:"purchase_id,omitempty"` + SaleId *Many2One `xmlrpc:"sale_id,omitempty"` + ScheduledDate *Time `xmlrpc:"scheduled_date,omitempty"` + ShowCheckAvailability *Bool `xmlrpc:"show_check_availability,omitempty"` + ShowLotsText *Bool `xmlrpc:"show_lots_text,omitempty"` + ShowMarkAsTodo *Bool `xmlrpc:"show_mark_as_todo,omitempty"` + ShowOperations *Bool `xmlrpc:"show_operations,omitempty"` + ShowValidate *Bool `xmlrpc:"show_validate,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// StockPickings represents array of stock.picking model. +type StockPickings []StockPicking + +// StockPickingModel is the odoo model name. +const StockPickingModel = "stock.picking" + +// Many2One convert StockPicking to *Many2One. +func (sp *StockPicking) Many2One() *Many2One { + return NewMany2One(sp.Id.Get(), "") +} + +// CreateStockPicking creates a new stock.picking model and returns its id. +func (c *Client) CreateStockPicking(sp *StockPicking) (int64, error) { + return c.Create(StockPickingModel, sp) +} + +// UpdateStockPicking updates an existing stock.picking record. +func (c *Client) UpdateStockPicking(sp *StockPicking) error { + return c.UpdateStockPickings([]int64{sp.Id.Get()}, sp) +} + +// UpdateStockPickings updates existing stock.picking records. +// All records (represented by ids) will be updated by sp values. +func (c *Client) UpdateStockPickings(ids []int64, sp *StockPicking) error { + return c.Update(StockPickingModel, ids, sp) +} + +// DeleteStockPicking deletes an existing stock.picking record. +func (c *Client) DeleteStockPicking(id int64) error { + return c.DeleteStockPickings([]int64{id}) +} + +// DeleteStockPickings deletes existing stock.picking records. +func (c *Client) DeleteStockPickings(ids []int64) error { + return c.Delete(StockPickingModel, ids) +} + +// GetStockPicking gets stock.picking existing record. +func (c *Client) GetStockPicking(id int64) (*StockPicking, error) { + sps, err := c.GetStockPickings([]int64{id}) + if err != nil { + return nil, err + } + if sps != nil && len(*sps) > 0 { + return &((*sps)[0]), nil + } + return nil, fmt.Errorf("id %v of stock.picking not found", id) +} + +// GetStockPickings gets stock.picking existing records. +func (c *Client) GetStockPickings(ids []int64) (*StockPickings, error) { + sps := &StockPickings{} + if err := c.Read(StockPickingModel, ids, nil, sps); err != nil { + return nil, err + } + return sps, nil +} + +// FindStockPicking finds stock.picking record by querying it with criteria. +func (c *Client) FindStockPicking(criteria *Criteria) (*StockPicking, error) { + sps := &StockPickings{} + if err := c.SearchRead(StockPickingModel, criteria, NewOptions().Limit(1), sps); err != nil { + return nil, err + } + if sps != nil && len(*sps) > 0 { + return &((*sps)[0]), nil + } + return nil, fmt.Errorf("no stock.picking was found with criteria %v", criteria) +} + +// FindStockPickings finds stock.picking records by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockPickings(criteria *Criteria, options *Options) (*StockPickings, error) { + sps := &StockPickings{} + if err := c.SearchRead(StockPickingModel, criteria, options, sps); err != nil { + return nil, err + } + return sps, nil +} + +// FindStockPickingIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockPickingIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(StockPickingModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindStockPickingId finds record id by querying it with criteria. +func (c *Client) FindStockPickingId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(StockPickingModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no stock.picking was found with criteria %v and options %v", criteria, options) +} diff --git a/stock_picking_type.go b/stock_picking_type.go new file mode 100644 index 00000000..7a4c0dab --- /dev/null +++ b/stock_picking_type.go @@ -0,0 +1,143 @@ +package odoo + +import ( + "fmt" +) + +// StockPickingType represents stock.picking.type model. +type StockPickingType struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + Active *Bool `xmlrpc:"active,omitempty"` + BarcodeNomenclatureId *Many2One `xmlrpc:"barcode_nomenclature_id,omitempty"` + Code *Selection `xmlrpc:"code,omitempty"` + Color *Int `xmlrpc:"color,omitempty"` + CountPicking *Int `xmlrpc:"count_picking,omitempty"` + CountPickingBackorders *Int `xmlrpc:"count_picking_backorders,omitempty"` + CountPickingDraft *Int `xmlrpc:"count_picking_draft,omitempty"` + CountPickingLate *Int `xmlrpc:"count_picking_late,omitempty"` + CountPickingReady *Int `xmlrpc:"count_picking_ready,omitempty"` + CountPickingWaiting *Int `xmlrpc:"count_picking_waiting,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DefaultLocationDestId *Many2One `xmlrpc:"default_location_dest_id,omitempty"` + DefaultLocationSrcId *Many2One `xmlrpc:"default_location_src_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LastDonePicking *String `xmlrpc:"last_done_picking,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + RatePickingBackorders *Int `xmlrpc:"rate_picking_backorders,omitempty"` + RatePickingLate *Int `xmlrpc:"rate_picking_late,omitempty"` + ReturnPickingTypeId *Many2One `xmlrpc:"return_picking_type_id,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + SequenceId *Many2One `xmlrpc:"sequence_id,omitempty"` + ShowEntirePacks *Bool `xmlrpc:"show_entire_packs,omitempty"` + ShowOperations *Bool `xmlrpc:"show_operations,omitempty"` + ShowReserved *Bool `xmlrpc:"show_reserved,omitempty"` + UseCreateLots *Bool `xmlrpc:"use_create_lots,omitempty"` + UseExistingLots *Bool `xmlrpc:"use_existing_lots,omitempty"` + WarehouseId *Many2One `xmlrpc:"warehouse_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// StockPickingTypes represents array of stock.picking.type model. +type StockPickingTypes []StockPickingType + +// StockPickingTypeModel is the odoo model name. +const StockPickingTypeModel = "stock.picking.type" + +// Many2One convert StockPickingType to *Many2One. +func (spt *StockPickingType) Many2One() *Many2One { + return NewMany2One(spt.Id.Get(), "") +} + +// CreateStockPickingType creates a new stock.picking.type model and returns its id. +func (c *Client) CreateStockPickingType(spt *StockPickingType) (int64, error) { + return c.Create(StockPickingTypeModel, spt) +} + +// UpdateStockPickingType updates an existing stock.picking.type record. +func (c *Client) UpdateStockPickingType(spt *StockPickingType) error { + return c.UpdateStockPickingTypes([]int64{spt.Id.Get()}, spt) +} + +// UpdateStockPickingTypes updates existing stock.picking.type records. +// All records (represented by ids) will be updated by spt values. +func (c *Client) UpdateStockPickingTypes(ids []int64, spt *StockPickingType) error { + return c.Update(StockPickingTypeModel, ids, spt) +} + +// DeleteStockPickingType deletes an existing stock.picking.type record. +func (c *Client) DeleteStockPickingType(id int64) error { + return c.DeleteStockPickingTypes([]int64{id}) +} + +// DeleteStockPickingTypes deletes existing stock.picking.type records. +func (c *Client) DeleteStockPickingTypes(ids []int64) error { + return c.Delete(StockPickingTypeModel, ids) +} + +// GetStockPickingType gets stock.picking.type existing record. +func (c *Client) GetStockPickingType(id int64) (*StockPickingType, error) { + spts, err := c.GetStockPickingTypes([]int64{id}) + if err != nil { + return nil, err + } + if spts != nil && len(*spts) > 0 { + return &((*spts)[0]), nil + } + return nil, fmt.Errorf("id %v of stock.picking.type not found", id) +} + +// GetStockPickingTypes gets stock.picking.type existing records. +func (c *Client) GetStockPickingTypes(ids []int64) (*StockPickingTypes, error) { + spts := &StockPickingTypes{} + if err := c.Read(StockPickingTypeModel, ids, nil, spts); err != nil { + return nil, err + } + return spts, nil +} + +// FindStockPickingType finds stock.picking.type record by querying it with criteria. +func (c *Client) FindStockPickingType(criteria *Criteria) (*StockPickingType, error) { + spts := &StockPickingTypes{} + if err := c.SearchRead(StockPickingTypeModel, criteria, NewOptions().Limit(1), spts); err != nil { + return nil, err + } + if spts != nil && len(*spts) > 0 { + return &((*spts)[0]), nil + } + return nil, fmt.Errorf("no stock.picking.type was found with criteria %v", criteria) +} + +// FindStockPickingTypes finds stock.picking.type records by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockPickingTypes(criteria *Criteria, options *Options) (*StockPickingTypes, error) { + spts := &StockPickingTypes{} + if err := c.SearchRead(StockPickingTypeModel, criteria, options, spts); err != nil { + return nil, err + } + return spts, nil +} + +// FindStockPickingTypeIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockPickingTypeIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(StockPickingTypeModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindStockPickingTypeId finds record id by querying it with criteria. +func (c *Client) FindStockPickingTypeId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(StockPickingTypeModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no stock.picking.type was found with criteria %v and options %v", criteria, options) +} diff --git a/stock_production_lot.go b/stock_production_lot.go new file mode 100644 index 00000000..554005fe --- /dev/null +++ b/stock_production_lot.go @@ -0,0 +1,135 @@ +package odoo + +import ( + "fmt" +) + +// StockProductionLot represents stock.production.lot model. +type StockProductionLot struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + MessageChannelIds *Relation `xmlrpc:"message_channel_ids,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageLastPost *Time `xmlrpc:"message_last_post,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MessageUnread *Bool `xmlrpc:"message_unread,omitempty"` + MessageUnreadCounter *Int `xmlrpc:"message_unread_counter,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + ProductId *Many2One `xmlrpc:"product_id,omitempty"` + ProductQty *Float `xmlrpc:"product_qty,omitempty"` + ProductUomId *Many2One `xmlrpc:"product_uom_id,omitempty"` + QuantIds *Relation `xmlrpc:"quant_ids,omitempty"` + Ref *String `xmlrpc:"ref,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// StockProductionLots represents array of stock.production.lot model. +type StockProductionLots []StockProductionLot + +// StockProductionLotModel is the odoo model name. +const StockProductionLotModel = "stock.production.lot" + +// Many2One convert StockProductionLot to *Many2One. +func (spl *StockProductionLot) Many2One() *Many2One { + return NewMany2One(spl.Id.Get(), "") +} + +// CreateStockProductionLot creates a new stock.production.lot model and returns its id. +func (c *Client) CreateStockProductionLot(spl *StockProductionLot) (int64, error) { + return c.Create(StockProductionLotModel, spl) +} + +// UpdateStockProductionLot updates an existing stock.production.lot record. +func (c *Client) UpdateStockProductionLot(spl *StockProductionLot) error { + return c.UpdateStockProductionLots([]int64{spl.Id.Get()}, spl) +} + +// UpdateStockProductionLots updates existing stock.production.lot records. +// All records (represented by ids) will be updated by spl values. +func (c *Client) UpdateStockProductionLots(ids []int64, spl *StockProductionLot) error { + return c.Update(StockProductionLotModel, ids, spl) +} + +// DeleteStockProductionLot deletes an existing stock.production.lot record. +func (c *Client) DeleteStockProductionLot(id int64) error { + return c.DeleteStockProductionLots([]int64{id}) +} + +// DeleteStockProductionLots deletes existing stock.production.lot records. +func (c *Client) DeleteStockProductionLots(ids []int64) error { + return c.Delete(StockProductionLotModel, ids) +} + +// GetStockProductionLot gets stock.production.lot existing record. +func (c *Client) GetStockProductionLot(id int64) (*StockProductionLot, error) { + spls, err := c.GetStockProductionLots([]int64{id}) + if err != nil { + return nil, err + } + if spls != nil && len(*spls) > 0 { + return &((*spls)[0]), nil + } + return nil, fmt.Errorf("id %v of stock.production.lot not found", id) +} + +// GetStockProductionLots gets stock.production.lot existing records. +func (c *Client) GetStockProductionLots(ids []int64) (*StockProductionLots, error) { + spls := &StockProductionLots{} + if err := c.Read(StockProductionLotModel, ids, nil, spls); err != nil { + return nil, err + } + return spls, nil +} + +// FindStockProductionLot finds stock.production.lot record by querying it with criteria. +func (c *Client) FindStockProductionLot(criteria *Criteria) (*StockProductionLot, error) { + spls := &StockProductionLots{} + if err := c.SearchRead(StockProductionLotModel, criteria, NewOptions().Limit(1), spls); err != nil { + return nil, err + } + if spls != nil && len(*spls) > 0 { + return &((*spls)[0]), nil + } + return nil, fmt.Errorf("no stock.production.lot was found with criteria %v", criteria) +} + +// FindStockProductionLots finds stock.production.lot records by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockProductionLots(criteria *Criteria, options *Options) (*StockProductionLots, error) { + spls := &StockProductionLots{} + if err := c.SearchRead(StockProductionLotModel, criteria, options, spls); err != nil { + return nil, err + } + return spls, nil +} + +// FindStockProductionLotIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockProductionLotIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(StockProductionLotModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindStockProductionLotId finds record id by querying it with criteria. +func (c *Client) FindStockProductionLotId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(StockProductionLotModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no stock.production.lot was found with criteria %v and options %v", criteria, options) +} diff --git a/stock_quant.go b/stock_quant.go new file mode 100644 index 00000000..7e6f07dc --- /dev/null +++ b/stock_quant.go @@ -0,0 +1,129 @@ +package odoo + +import ( + "fmt" +) + +// StockQuant represents stock.quant model. +type StockQuant struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` + InDate *Time `xmlrpc:"in_date,omitempty"` + LocationId *Many2One `xmlrpc:"location_id,omitempty"` + LotId *Many2One `xmlrpc:"lot_id,omitempty"` + OwnerId *Many2One `xmlrpc:"owner_id,omitempty"` + PackageId *Many2One `xmlrpc:"package_id,omitempty"` + ProductId *Many2One `xmlrpc:"product_id,omitempty"` + ProductTmplId *Many2One `xmlrpc:"product_tmpl_id,omitempty"` + ProductUomId *Many2One `xmlrpc:"product_uom_id,omitempty"` + Quantity *Float `xmlrpc:"quantity,omitempty"` + ReservedQuantity *Float `xmlrpc:"reserved_quantity,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// StockQuants represents array of stock.quant model. +type StockQuants []StockQuant + +// StockQuantModel is the odoo model name. +const StockQuantModel = "stock.quant" + +// Many2One convert StockQuant to *Many2One. +func (sq *StockQuant) Many2One() *Many2One { + return NewMany2One(sq.Id.Get(), "") +} + +// CreateStockQuant creates a new stock.quant model and returns its id. +func (c *Client) CreateStockQuant(sq *StockQuant) (int64, error) { + return c.Create(StockQuantModel, sq) +} + +// UpdateStockQuant updates an existing stock.quant record. +func (c *Client) UpdateStockQuant(sq *StockQuant) error { + return c.UpdateStockQuants([]int64{sq.Id.Get()}, sq) +} + +// UpdateStockQuants updates existing stock.quant records. +// All records (represented by ids) will be updated by sq values. +func (c *Client) UpdateStockQuants(ids []int64, sq *StockQuant) error { + return c.Update(StockQuantModel, ids, sq) +} + +// DeleteStockQuant deletes an existing stock.quant record. +func (c *Client) DeleteStockQuant(id int64) error { + return c.DeleteStockQuants([]int64{id}) +} + +// DeleteStockQuants deletes existing stock.quant records. +func (c *Client) DeleteStockQuants(ids []int64) error { + return c.Delete(StockQuantModel, ids) +} + +// GetStockQuant gets stock.quant existing record. +func (c *Client) GetStockQuant(id int64) (*StockQuant, error) { + sqs, err := c.GetStockQuants([]int64{id}) + if err != nil { + return nil, err + } + if sqs != nil && len(*sqs) > 0 { + return &((*sqs)[0]), nil + } + return nil, fmt.Errorf("id %v of stock.quant not found", id) +} + +// GetStockQuants gets stock.quant existing records. +func (c *Client) GetStockQuants(ids []int64) (*StockQuants, error) { + sqs := &StockQuants{} + if err := c.Read(StockQuantModel, ids, nil, sqs); err != nil { + return nil, err + } + return sqs, nil +} + +// FindStockQuant finds stock.quant record by querying it with criteria. +func (c *Client) FindStockQuant(criteria *Criteria) (*StockQuant, error) { + sqs := &StockQuants{} + if err := c.SearchRead(StockQuantModel, criteria, NewOptions().Limit(1), sqs); err != nil { + return nil, err + } + if sqs != nil && len(*sqs) > 0 { + return &((*sqs)[0]), nil + } + return nil, fmt.Errorf("no stock.quant was found with criteria %v", criteria) +} + +// FindStockQuants finds stock.quant records by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockQuants(criteria *Criteria, options *Options) (*StockQuants, error) { + sqs := &StockQuants{} + if err := c.SearchRead(StockQuantModel, criteria, options, sqs); err != nil { + return nil, err + } + return sqs, nil +} + +// FindStockQuantIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockQuantIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(StockQuantModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindStockQuantId finds record id by querying it with criteria. +func (c *Client) FindStockQuantId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(StockQuantModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no stock.quant was found with criteria %v and options %v", criteria, options) +} diff --git a/stock_quant_package.go b/stock_quant_package.go new file mode 100644 index 00000000..837681b9 --- /dev/null +++ b/stock_quant_package.go @@ -0,0 +1,130 @@ +package odoo + +import ( + "fmt" +) + +// StockQuantPackage represents stock.quant.package model. +type StockQuantPackage struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrentDestinationLocationId *Many2One `xmlrpc:"current_destination_location_id,omitempty"` + CurrentPickingId *Bool `xmlrpc:"current_picking_id,omitempty"` + CurrentPickingMoveLineIds *Relation `xmlrpc:"current_picking_move_line_ids,omitempty"` + CurrentSourceLocationId *Many2One `xmlrpc:"current_source_location_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsProcessed *Bool `xmlrpc:"is_processed,omitempty"` + LocationId *Many2One `xmlrpc:"location_id,omitempty"` + MoveLineIds *Relation `xmlrpc:"move_line_ids,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + OwnerId *Many2One `xmlrpc:"owner_id,omitempty"` + PackagingId *Many2One `xmlrpc:"packaging_id,omitempty"` + QuantIds *Relation `xmlrpc:"quant_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// StockQuantPackages represents array of stock.quant.package model. +type StockQuantPackages []StockQuantPackage + +// StockQuantPackageModel is the odoo model name. +const StockQuantPackageModel = "stock.quant.package" + +// Many2One convert StockQuantPackage to *Many2One. +func (sqp *StockQuantPackage) Many2One() *Many2One { + return NewMany2One(sqp.Id.Get(), "") +} + +// CreateStockQuantPackage creates a new stock.quant.package model and returns its id. +func (c *Client) CreateStockQuantPackage(sqp *StockQuantPackage) (int64, error) { + return c.Create(StockQuantPackageModel, sqp) +} + +// UpdateStockQuantPackage updates an existing stock.quant.package record. +func (c *Client) UpdateStockQuantPackage(sqp *StockQuantPackage) error { + return c.UpdateStockQuantPackages([]int64{sqp.Id.Get()}, sqp) +} + +// UpdateStockQuantPackages updates existing stock.quant.package records. +// All records (represented by ids) will be updated by sqp values. +func (c *Client) UpdateStockQuantPackages(ids []int64, sqp *StockQuantPackage) error { + return c.Update(StockQuantPackageModel, ids, sqp) +} + +// DeleteStockQuantPackage deletes an existing stock.quant.package record. +func (c *Client) DeleteStockQuantPackage(id int64) error { + return c.DeleteStockQuantPackages([]int64{id}) +} + +// DeleteStockQuantPackages deletes existing stock.quant.package records. +func (c *Client) DeleteStockQuantPackages(ids []int64) error { + return c.Delete(StockQuantPackageModel, ids) +} + +// GetStockQuantPackage gets stock.quant.package existing record. +func (c *Client) GetStockQuantPackage(id int64) (*StockQuantPackage, error) { + sqps, err := c.GetStockQuantPackages([]int64{id}) + if err != nil { + return nil, err + } + if sqps != nil && len(*sqps) > 0 { + return &((*sqps)[0]), nil + } + return nil, fmt.Errorf("id %v of stock.quant.package not found", id) +} + +// GetStockQuantPackages gets stock.quant.package existing records. +func (c *Client) GetStockQuantPackages(ids []int64) (*StockQuantPackages, error) { + sqps := &StockQuantPackages{} + if err := c.Read(StockQuantPackageModel, ids, nil, sqps); err != nil { + return nil, err + } + return sqps, nil +} + +// FindStockQuantPackage finds stock.quant.package record by querying it with criteria. +func (c *Client) FindStockQuantPackage(criteria *Criteria) (*StockQuantPackage, error) { + sqps := &StockQuantPackages{} + if err := c.SearchRead(StockQuantPackageModel, criteria, NewOptions().Limit(1), sqps); err != nil { + return nil, err + } + if sqps != nil && len(*sqps) > 0 { + return &((*sqps)[0]), nil + } + return nil, fmt.Errorf("no stock.quant.package was found with criteria %v", criteria) +} + +// FindStockQuantPackages finds stock.quant.package records by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockQuantPackages(criteria *Criteria, options *Options) (*StockQuantPackages, error) { + sqps := &StockQuantPackages{} + if err := c.SearchRead(StockQuantPackageModel, criteria, options, sqps); err != nil { + return nil, err + } + return sqps, nil +} + +// FindStockQuantPackageIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockQuantPackageIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(StockQuantPackageModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindStockQuantPackageId finds record id by querying it with criteria. +func (c *Client) FindStockQuantPackageId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(StockQuantPackageModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no stock.quant.package was found with criteria %v and options %v", criteria, options) +} diff --git a/stock_quantity_history.go b/stock_quantity_history.go new file mode 100644 index 00000000..9efac523 --- /dev/null +++ b/stock_quantity_history.go @@ -0,0 +1,120 @@ +package odoo + +import ( + "fmt" +) + +// StockQuantityHistory represents stock.quantity.history model. +type StockQuantityHistory struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + ComputeAtDate *Selection `xmlrpc:"compute_at_date,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Date *Time `xmlrpc:"date,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// StockQuantityHistorys represents array of stock.quantity.history model. +type StockQuantityHistorys []StockQuantityHistory + +// StockQuantityHistoryModel is the odoo model name. +const StockQuantityHistoryModel = "stock.quantity.history" + +// Many2One convert StockQuantityHistory to *Many2One. +func (sqh *StockQuantityHistory) Many2One() *Many2One { + return NewMany2One(sqh.Id.Get(), "") +} + +// CreateStockQuantityHistory creates a new stock.quantity.history model and returns its id. +func (c *Client) CreateStockQuantityHistory(sqh *StockQuantityHistory) (int64, error) { + return c.Create(StockQuantityHistoryModel, sqh) +} + +// UpdateStockQuantityHistory updates an existing stock.quantity.history record. +func (c *Client) UpdateStockQuantityHistory(sqh *StockQuantityHistory) error { + return c.UpdateStockQuantityHistorys([]int64{sqh.Id.Get()}, sqh) +} + +// UpdateStockQuantityHistorys updates existing stock.quantity.history records. +// All records (represented by ids) will be updated by sqh values. +func (c *Client) UpdateStockQuantityHistorys(ids []int64, sqh *StockQuantityHistory) error { + return c.Update(StockQuantityHistoryModel, ids, sqh) +} + +// DeleteStockQuantityHistory deletes an existing stock.quantity.history record. +func (c *Client) DeleteStockQuantityHistory(id int64) error { + return c.DeleteStockQuantityHistorys([]int64{id}) +} + +// DeleteStockQuantityHistorys deletes existing stock.quantity.history records. +func (c *Client) DeleteStockQuantityHistorys(ids []int64) error { + return c.Delete(StockQuantityHistoryModel, ids) +} + +// GetStockQuantityHistory gets stock.quantity.history existing record. +func (c *Client) GetStockQuantityHistory(id int64) (*StockQuantityHistory, error) { + sqhs, err := c.GetStockQuantityHistorys([]int64{id}) + if err != nil { + return nil, err + } + if sqhs != nil && len(*sqhs) > 0 { + return &((*sqhs)[0]), nil + } + return nil, fmt.Errorf("id %v of stock.quantity.history not found", id) +} + +// GetStockQuantityHistorys gets stock.quantity.history existing records. +func (c *Client) GetStockQuantityHistorys(ids []int64) (*StockQuantityHistorys, error) { + sqhs := &StockQuantityHistorys{} + if err := c.Read(StockQuantityHistoryModel, ids, nil, sqhs); err != nil { + return nil, err + } + return sqhs, nil +} + +// FindStockQuantityHistory finds stock.quantity.history record by querying it with criteria. +func (c *Client) FindStockQuantityHistory(criteria *Criteria) (*StockQuantityHistory, error) { + sqhs := &StockQuantityHistorys{} + if err := c.SearchRead(StockQuantityHistoryModel, criteria, NewOptions().Limit(1), sqhs); err != nil { + return nil, err + } + if sqhs != nil && len(*sqhs) > 0 { + return &((*sqhs)[0]), nil + } + return nil, fmt.Errorf("no stock.quantity.history was found with criteria %v", criteria) +} + +// FindStockQuantityHistorys finds stock.quantity.history records by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockQuantityHistorys(criteria *Criteria, options *Options) (*StockQuantityHistorys, error) { + sqhs := &StockQuantityHistorys{} + if err := c.SearchRead(StockQuantityHistoryModel, criteria, options, sqhs); err != nil { + return nil, err + } + return sqhs, nil +} + +// FindStockQuantityHistoryIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockQuantityHistoryIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(StockQuantityHistoryModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindStockQuantityHistoryId finds record id by querying it with criteria. +func (c *Client) FindStockQuantityHistoryId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(StockQuantityHistoryModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no stock.quantity.history was found with criteria %v and options %v", criteria, options) +} diff --git a/stock_return_picking.go b/stock_return_picking.go new file mode 100644 index 00000000..ae298168 --- /dev/null +++ b/stock_return_picking.go @@ -0,0 +1,124 @@ +package odoo + +import ( + "fmt" +) + +// StockReturnPicking represents stock.return.picking model. +type StockReturnPicking struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LocationId *Many2One `xmlrpc:"location_id,omitempty"` + MoveDestExists *Bool `xmlrpc:"move_dest_exists,omitempty"` + OriginalLocationId *Many2One `xmlrpc:"original_location_id,omitempty"` + ParentLocationId *Many2One `xmlrpc:"parent_location_id,omitempty"` + PickingId *Many2One `xmlrpc:"picking_id,omitempty"` + ProductReturnMoves *Relation `xmlrpc:"product_return_moves,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// StockReturnPickings represents array of stock.return.picking model. +type StockReturnPickings []StockReturnPicking + +// StockReturnPickingModel is the odoo model name. +const StockReturnPickingModel = "stock.return.picking" + +// Many2One convert StockReturnPicking to *Many2One. +func (srp *StockReturnPicking) Many2One() *Many2One { + return NewMany2One(srp.Id.Get(), "") +} + +// CreateStockReturnPicking creates a new stock.return.picking model and returns its id. +func (c *Client) CreateStockReturnPicking(srp *StockReturnPicking) (int64, error) { + return c.Create(StockReturnPickingModel, srp) +} + +// UpdateStockReturnPicking updates an existing stock.return.picking record. +func (c *Client) UpdateStockReturnPicking(srp *StockReturnPicking) error { + return c.UpdateStockReturnPickings([]int64{srp.Id.Get()}, srp) +} + +// UpdateStockReturnPickings updates existing stock.return.picking records. +// All records (represented by ids) will be updated by srp values. +func (c *Client) UpdateStockReturnPickings(ids []int64, srp *StockReturnPicking) error { + return c.Update(StockReturnPickingModel, ids, srp) +} + +// DeleteStockReturnPicking deletes an existing stock.return.picking record. +func (c *Client) DeleteStockReturnPicking(id int64) error { + return c.DeleteStockReturnPickings([]int64{id}) +} + +// DeleteStockReturnPickings deletes existing stock.return.picking records. +func (c *Client) DeleteStockReturnPickings(ids []int64) error { + return c.Delete(StockReturnPickingModel, ids) +} + +// GetStockReturnPicking gets stock.return.picking existing record. +func (c *Client) GetStockReturnPicking(id int64) (*StockReturnPicking, error) { + srps, err := c.GetStockReturnPickings([]int64{id}) + if err != nil { + return nil, err + } + if srps != nil && len(*srps) > 0 { + return &((*srps)[0]), nil + } + return nil, fmt.Errorf("id %v of stock.return.picking not found", id) +} + +// GetStockReturnPickings gets stock.return.picking existing records. +func (c *Client) GetStockReturnPickings(ids []int64) (*StockReturnPickings, error) { + srps := &StockReturnPickings{} + if err := c.Read(StockReturnPickingModel, ids, nil, srps); err != nil { + return nil, err + } + return srps, nil +} + +// FindStockReturnPicking finds stock.return.picking record by querying it with criteria. +func (c *Client) FindStockReturnPicking(criteria *Criteria) (*StockReturnPicking, error) { + srps := &StockReturnPickings{} + if err := c.SearchRead(StockReturnPickingModel, criteria, NewOptions().Limit(1), srps); err != nil { + return nil, err + } + if srps != nil && len(*srps) > 0 { + return &((*srps)[0]), nil + } + return nil, fmt.Errorf("no stock.return.picking was found with criteria %v", criteria) +} + +// FindStockReturnPickings finds stock.return.picking records by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockReturnPickings(criteria *Criteria, options *Options) (*StockReturnPickings, error) { + srps := &StockReturnPickings{} + if err := c.SearchRead(StockReturnPickingModel, criteria, options, srps); err != nil { + return nil, err + } + return srps, nil +} + +// FindStockReturnPickingIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockReturnPickingIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(StockReturnPickingModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindStockReturnPickingId finds record id by querying it with criteria. +func (c *Client) FindStockReturnPickingId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(StockReturnPickingModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no stock.return.picking was found with criteria %v and options %v", criteria, options) +} diff --git a/stock_return_picking_line.go b/stock_return_picking_line.go new file mode 100644 index 00000000..26f81d79 --- /dev/null +++ b/stock_return_picking_line.go @@ -0,0 +1,124 @@ +package odoo + +import ( + "fmt" +) + +// StockReturnPickingLine represents stock.return.picking.line model. +type StockReturnPickingLine struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + MoveId *Many2One `xmlrpc:"move_id,omitempty"` + ProductId *Many2One `xmlrpc:"product_id,omitempty"` + Quantity *Float `xmlrpc:"quantity,omitempty"` + ToRefund *Bool `xmlrpc:"to_refund,omitempty"` + UomId *Many2One `xmlrpc:"uom_id,omitempty"` + WizardId *Many2One `xmlrpc:"wizard_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// StockReturnPickingLines represents array of stock.return.picking.line model. +type StockReturnPickingLines []StockReturnPickingLine + +// StockReturnPickingLineModel is the odoo model name. +const StockReturnPickingLineModel = "stock.return.picking.line" + +// Many2One convert StockReturnPickingLine to *Many2One. +func (srpl *StockReturnPickingLine) Many2One() *Many2One { + return NewMany2One(srpl.Id.Get(), "") +} + +// CreateStockReturnPickingLine creates a new stock.return.picking.line model and returns its id. +func (c *Client) CreateStockReturnPickingLine(srpl *StockReturnPickingLine) (int64, error) { + return c.Create(StockReturnPickingLineModel, srpl) +} + +// UpdateStockReturnPickingLine updates an existing stock.return.picking.line record. +func (c *Client) UpdateStockReturnPickingLine(srpl *StockReturnPickingLine) error { + return c.UpdateStockReturnPickingLines([]int64{srpl.Id.Get()}, srpl) +} + +// UpdateStockReturnPickingLines updates existing stock.return.picking.line records. +// All records (represented by ids) will be updated by srpl values. +func (c *Client) UpdateStockReturnPickingLines(ids []int64, srpl *StockReturnPickingLine) error { + return c.Update(StockReturnPickingLineModel, ids, srpl) +} + +// DeleteStockReturnPickingLine deletes an existing stock.return.picking.line record. +func (c *Client) DeleteStockReturnPickingLine(id int64) error { + return c.DeleteStockReturnPickingLines([]int64{id}) +} + +// DeleteStockReturnPickingLines deletes existing stock.return.picking.line records. +func (c *Client) DeleteStockReturnPickingLines(ids []int64) error { + return c.Delete(StockReturnPickingLineModel, ids) +} + +// GetStockReturnPickingLine gets stock.return.picking.line existing record. +func (c *Client) GetStockReturnPickingLine(id int64) (*StockReturnPickingLine, error) { + srpls, err := c.GetStockReturnPickingLines([]int64{id}) + if err != nil { + return nil, err + } + if srpls != nil && len(*srpls) > 0 { + return &((*srpls)[0]), nil + } + return nil, fmt.Errorf("id %v of stock.return.picking.line not found", id) +} + +// GetStockReturnPickingLines gets stock.return.picking.line existing records. +func (c *Client) GetStockReturnPickingLines(ids []int64) (*StockReturnPickingLines, error) { + srpls := &StockReturnPickingLines{} + if err := c.Read(StockReturnPickingLineModel, ids, nil, srpls); err != nil { + return nil, err + } + return srpls, nil +} + +// FindStockReturnPickingLine finds stock.return.picking.line record by querying it with criteria. +func (c *Client) FindStockReturnPickingLine(criteria *Criteria) (*StockReturnPickingLine, error) { + srpls := &StockReturnPickingLines{} + if err := c.SearchRead(StockReturnPickingLineModel, criteria, NewOptions().Limit(1), srpls); err != nil { + return nil, err + } + if srpls != nil && len(*srpls) > 0 { + return &((*srpls)[0]), nil + } + return nil, fmt.Errorf("no stock.return.picking.line was found with criteria %v", criteria) +} + +// FindStockReturnPickingLines finds stock.return.picking.line records by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockReturnPickingLines(criteria *Criteria, options *Options) (*StockReturnPickingLines, error) { + srpls := &StockReturnPickingLines{} + if err := c.SearchRead(StockReturnPickingLineModel, criteria, options, srpls); err != nil { + return nil, err + } + return srpls, nil +} + +// FindStockReturnPickingLineIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockReturnPickingLineIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(StockReturnPickingLineModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindStockReturnPickingLineId finds record id by querying it with criteria. +func (c *Client) FindStockReturnPickingLineId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(StockReturnPickingLineModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no stock.return.picking.line was found with criteria %v and options %v", criteria, options) +} diff --git a/stock_scheduler_compute.go b/stock_scheduler_compute.go new file mode 100644 index 00000000..334eec7e --- /dev/null +++ b/stock_scheduler_compute.go @@ -0,0 +1,118 @@ +package odoo + +import ( + "fmt" +) + +// StockSchedulerCompute represents stock.scheduler.compute model. +type StockSchedulerCompute struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` +} + +// StockSchedulerComputes represents array of stock.scheduler.compute model. +type StockSchedulerComputes []StockSchedulerCompute + +// StockSchedulerComputeModel is the odoo model name. +const StockSchedulerComputeModel = "stock.scheduler.compute" + +// Many2One convert StockSchedulerCompute to *Many2One. +func (ssc *StockSchedulerCompute) Many2One() *Many2One { + return NewMany2One(ssc.Id.Get(), "") +} + +// CreateStockSchedulerCompute creates a new stock.scheduler.compute model and returns its id. +func (c *Client) CreateStockSchedulerCompute(ssc *StockSchedulerCompute) (int64, error) { + return c.Create(StockSchedulerComputeModel, ssc) +} + +// UpdateStockSchedulerCompute updates an existing stock.scheduler.compute record. +func (c *Client) UpdateStockSchedulerCompute(ssc *StockSchedulerCompute) error { + return c.UpdateStockSchedulerComputes([]int64{ssc.Id.Get()}, ssc) +} + +// UpdateStockSchedulerComputes updates existing stock.scheduler.compute records. +// All records (represented by ids) will be updated by ssc values. +func (c *Client) UpdateStockSchedulerComputes(ids []int64, ssc *StockSchedulerCompute) error { + return c.Update(StockSchedulerComputeModel, ids, ssc) +} + +// DeleteStockSchedulerCompute deletes an existing stock.scheduler.compute record. +func (c *Client) DeleteStockSchedulerCompute(id int64) error { + return c.DeleteStockSchedulerComputes([]int64{id}) +} + +// DeleteStockSchedulerComputes deletes existing stock.scheduler.compute records. +func (c *Client) DeleteStockSchedulerComputes(ids []int64) error { + return c.Delete(StockSchedulerComputeModel, ids) +} + +// GetStockSchedulerCompute gets stock.scheduler.compute existing record. +func (c *Client) GetStockSchedulerCompute(id int64) (*StockSchedulerCompute, error) { + sscs, err := c.GetStockSchedulerComputes([]int64{id}) + if err != nil { + return nil, err + } + if sscs != nil && len(*sscs) > 0 { + return &((*sscs)[0]), nil + } + return nil, fmt.Errorf("id %v of stock.scheduler.compute not found", id) +} + +// GetStockSchedulerComputes gets stock.scheduler.compute existing records. +func (c *Client) GetStockSchedulerComputes(ids []int64) (*StockSchedulerComputes, error) { + sscs := &StockSchedulerComputes{} + if err := c.Read(StockSchedulerComputeModel, ids, nil, sscs); err != nil { + return nil, err + } + return sscs, nil +} + +// FindStockSchedulerCompute finds stock.scheduler.compute record by querying it with criteria. +func (c *Client) FindStockSchedulerCompute(criteria *Criteria) (*StockSchedulerCompute, error) { + sscs := &StockSchedulerComputes{} + if err := c.SearchRead(StockSchedulerComputeModel, criteria, NewOptions().Limit(1), sscs); err != nil { + return nil, err + } + if sscs != nil && len(*sscs) > 0 { + return &((*sscs)[0]), nil + } + return nil, fmt.Errorf("no stock.scheduler.compute was found with criteria %v", criteria) +} + +// FindStockSchedulerComputes finds stock.scheduler.compute records by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockSchedulerComputes(criteria *Criteria, options *Options) (*StockSchedulerComputes, error) { + sscs := &StockSchedulerComputes{} + if err := c.SearchRead(StockSchedulerComputeModel, criteria, options, sscs); err != nil { + return nil, err + } + return sscs, nil +} + +// FindStockSchedulerComputeIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockSchedulerComputeIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(StockSchedulerComputeModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindStockSchedulerComputeId finds record id by querying it with criteria. +func (c *Client) FindStockSchedulerComputeId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(StockSchedulerComputeModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no stock.scheduler.compute was found with criteria %v and options %v", criteria, options) +} diff --git a/stock_scrap.go b/stock_scrap.go new file mode 100644 index 00000000..5ee3ee46 --- /dev/null +++ b/stock_scrap.go @@ -0,0 +1,133 @@ +package odoo + +import ( + "fmt" +) + +// StockScrap represents stock.scrap model. +type StockScrap struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DateExpected *Time `xmlrpc:"date_expected,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LocationId *Many2One `xmlrpc:"location_id,omitempty"` + LotId *Many2One `xmlrpc:"lot_id,omitempty"` + MoveId *Many2One `xmlrpc:"move_id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Origin *String `xmlrpc:"origin,omitempty"` + OwnerId *Many2One `xmlrpc:"owner_id,omitempty"` + PackageId *Many2One `xmlrpc:"package_id,omitempty"` + PickingId *Many2One `xmlrpc:"picking_id,omitempty"` + ProductId *Many2One `xmlrpc:"product_id,omitempty"` + ProductUomId *Many2One `xmlrpc:"product_uom_id,omitempty"` + ScrapLocationId *Many2One `xmlrpc:"scrap_location_id,omitempty"` + ScrapQty *Float `xmlrpc:"scrap_qty,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + Tracking *Selection `xmlrpc:"tracking,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// StockScraps represents array of stock.scrap model. +type StockScraps []StockScrap + +// StockScrapModel is the odoo model name. +const StockScrapModel = "stock.scrap" + +// Many2One convert StockScrap to *Many2One. +func (ss *StockScrap) Many2One() *Many2One { + return NewMany2One(ss.Id.Get(), "") +} + +// CreateStockScrap creates a new stock.scrap model and returns its id. +func (c *Client) CreateStockScrap(ss *StockScrap) (int64, error) { + return c.Create(StockScrapModel, ss) +} + +// UpdateStockScrap updates an existing stock.scrap record. +func (c *Client) UpdateStockScrap(ss *StockScrap) error { + return c.UpdateStockScraps([]int64{ss.Id.Get()}, ss) +} + +// UpdateStockScraps updates existing stock.scrap records. +// All records (represented by ids) will be updated by ss values. +func (c *Client) UpdateStockScraps(ids []int64, ss *StockScrap) error { + return c.Update(StockScrapModel, ids, ss) +} + +// DeleteStockScrap deletes an existing stock.scrap record. +func (c *Client) DeleteStockScrap(id int64) error { + return c.DeleteStockScraps([]int64{id}) +} + +// DeleteStockScraps deletes existing stock.scrap records. +func (c *Client) DeleteStockScraps(ids []int64) error { + return c.Delete(StockScrapModel, ids) +} + +// GetStockScrap gets stock.scrap existing record. +func (c *Client) GetStockScrap(id int64) (*StockScrap, error) { + sss, err := c.GetStockScraps([]int64{id}) + if err != nil { + return nil, err + } + if sss != nil && len(*sss) > 0 { + return &((*sss)[0]), nil + } + return nil, fmt.Errorf("id %v of stock.scrap not found", id) +} + +// GetStockScraps gets stock.scrap existing records. +func (c *Client) GetStockScraps(ids []int64) (*StockScraps, error) { + sss := &StockScraps{} + if err := c.Read(StockScrapModel, ids, nil, sss); err != nil { + return nil, err + } + return sss, nil +} + +// FindStockScrap finds stock.scrap record by querying it with criteria. +func (c *Client) FindStockScrap(criteria *Criteria) (*StockScrap, error) { + sss := &StockScraps{} + if err := c.SearchRead(StockScrapModel, criteria, NewOptions().Limit(1), sss); err != nil { + return nil, err + } + if sss != nil && len(*sss) > 0 { + return &((*sss)[0]), nil + } + return nil, fmt.Errorf("no stock.scrap was found with criteria %v", criteria) +} + +// FindStockScraps finds stock.scrap records by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockScraps(criteria *Criteria, options *Options) (*StockScraps, error) { + sss := &StockScraps{} + if err := c.SearchRead(StockScrapModel, criteria, options, sss); err != nil { + return nil, err + } + return sss, nil +} + +// FindStockScrapIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockScrapIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(StockScrapModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindStockScrapId finds record id by querying it with criteria. +func (c *Client) FindStockScrapId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(StockScrapModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no stock.scrap was found with criteria %v and options %v", criteria, options) +} diff --git a/stock_traceability_report.go b/stock_traceability_report.go new file mode 100644 index 00000000..d2c44374 --- /dev/null +++ b/stock_traceability_report.go @@ -0,0 +1,118 @@ +package odoo + +import ( + "fmt" +) + +// StockTraceabilityReport represents stock.traceability.report model. +type StockTraceabilityReport struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` +} + +// StockTraceabilityReports represents array of stock.traceability.report model. +type StockTraceabilityReports []StockTraceabilityReport + +// StockTraceabilityReportModel is the odoo model name. +const StockTraceabilityReportModel = "stock.traceability.report" + +// Many2One convert StockTraceabilityReport to *Many2One. +func (str *StockTraceabilityReport) Many2One() *Many2One { + return NewMany2One(str.Id.Get(), "") +} + +// CreateStockTraceabilityReport creates a new stock.traceability.report model and returns its id. +func (c *Client) CreateStockTraceabilityReport(str *StockTraceabilityReport) (int64, error) { + return c.Create(StockTraceabilityReportModel, str) +} + +// UpdateStockTraceabilityReport updates an existing stock.traceability.report record. +func (c *Client) UpdateStockTraceabilityReport(str *StockTraceabilityReport) error { + return c.UpdateStockTraceabilityReports([]int64{str.Id.Get()}, str) +} + +// UpdateStockTraceabilityReports updates existing stock.traceability.report records. +// All records (represented by ids) will be updated by str values. +func (c *Client) UpdateStockTraceabilityReports(ids []int64, str *StockTraceabilityReport) error { + return c.Update(StockTraceabilityReportModel, ids, str) +} + +// DeleteStockTraceabilityReport deletes an existing stock.traceability.report record. +func (c *Client) DeleteStockTraceabilityReport(id int64) error { + return c.DeleteStockTraceabilityReports([]int64{id}) +} + +// DeleteStockTraceabilityReports deletes existing stock.traceability.report records. +func (c *Client) DeleteStockTraceabilityReports(ids []int64) error { + return c.Delete(StockTraceabilityReportModel, ids) +} + +// GetStockTraceabilityReport gets stock.traceability.report existing record. +func (c *Client) GetStockTraceabilityReport(id int64) (*StockTraceabilityReport, error) { + strs, err := c.GetStockTraceabilityReports([]int64{id}) + if err != nil { + return nil, err + } + if strs != nil && len(*strs) > 0 { + return &((*strs)[0]), nil + } + return nil, fmt.Errorf("id %v of stock.traceability.report not found", id) +} + +// GetStockTraceabilityReports gets stock.traceability.report existing records. +func (c *Client) GetStockTraceabilityReports(ids []int64) (*StockTraceabilityReports, error) { + strs := &StockTraceabilityReports{} + if err := c.Read(StockTraceabilityReportModel, ids, nil, strs); err != nil { + return nil, err + } + return strs, nil +} + +// FindStockTraceabilityReport finds stock.traceability.report record by querying it with criteria. +func (c *Client) FindStockTraceabilityReport(criteria *Criteria) (*StockTraceabilityReport, error) { + strs := &StockTraceabilityReports{} + if err := c.SearchRead(StockTraceabilityReportModel, criteria, NewOptions().Limit(1), strs); err != nil { + return nil, err + } + if strs != nil && len(*strs) > 0 { + return &((*strs)[0]), nil + } + return nil, fmt.Errorf("no stock.traceability.report was found with criteria %v", criteria) +} + +// FindStockTraceabilityReports finds stock.traceability.report records by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockTraceabilityReports(criteria *Criteria, options *Options) (*StockTraceabilityReports, error) { + strs := &StockTraceabilityReports{} + if err := c.SearchRead(StockTraceabilityReportModel, criteria, options, strs); err != nil { + return nil, err + } + return strs, nil +} + +// FindStockTraceabilityReportIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockTraceabilityReportIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(StockTraceabilityReportModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindStockTraceabilityReportId finds record id by querying it with criteria. +func (c *Client) FindStockTraceabilityReportId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(StockTraceabilityReportModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no stock.traceability.report was found with criteria %v and options %v", criteria, options) +} diff --git a/stock_warehouse.go b/stock_warehouse.go new file mode 100644 index 00000000..7893a511 --- /dev/null +++ b/stock_warehouse.go @@ -0,0 +1,146 @@ +package odoo + +import ( + "fmt" +) + +// StockWarehouse represents stock.warehouse model. +type StockWarehouse struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + Active *Bool `xmlrpc:"active,omitempty"` + BuyPullId *Many2One `xmlrpc:"buy_pull_id,omitempty"` + BuyToResupply *Bool `xmlrpc:"buy_to_resupply,omitempty"` + Code *String `xmlrpc:"code,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CrossdockRouteId *Many2One `xmlrpc:"crossdock_route_id,omitempty"` + DefaultResupplyWhId *Many2One `xmlrpc:"default_resupply_wh_id,omitempty"` + DeliveryRouteId *Many2One `xmlrpc:"delivery_route_id,omitempty"` + DeliverySteps *Selection `xmlrpc:"delivery_steps,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + InTypeId *Many2One `xmlrpc:"in_type_id,omitempty"` + IntTypeId *Many2One `xmlrpc:"int_type_id,omitempty"` + LotStockId *Many2One `xmlrpc:"lot_stock_id,omitempty"` + MtoPullId *Many2One `xmlrpc:"mto_pull_id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + OutTypeId *Many2One `xmlrpc:"out_type_id,omitempty"` + PackTypeId *Many2One `xmlrpc:"pack_type_id,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PickTypeId *Many2One `xmlrpc:"pick_type_id,omitempty"` + ReceptionRouteId *Many2One `xmlrpc:"reception_route_id,omitempty"` + ReceptionSteps *Selection `xmlrpc:"reception_steps,omitempty"` + ResupplyRouteIds *Relation `xmlrpc:"resupply_route_ids,omitempty"` + ResupplyWhIds *Relation `xmlrpc:"resupply_wh_ids,omitempty"` + RouteIds *Relation `xmlrpc:"route_ids,omitempty"` + ViewLocationId *Many2One `xmlrpc:"view_location_id,omitempty"` + WhInputStockLocId *Many2One `xmlrpc:"wh_input_stock_loc_id,omitempty"` + WhOutputStockLocId *Many2One `xmlrpc:"wh_output_stock_loc_id,omitempty"` + WhPackStockLocId *Many2One `xmlrpc:"wh_pack_stock_loc_id,omitempty"` + WhQcStockLocId *Many2One `xmlrpc:"wh_qc_stock_loc_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// StockWarehouses represents array of stock.warehouse model. +type StockWarehouses []StockWarehouse + +// StockWarehouseModel is the odoo model name. +const StockWarehouseModel = "stock.warehouse" + +// Many2One convert StockWarehouse to *Many2One. +func (sw *StockWarehouse) Many2One() *Many2One { + return NewMany2One(sw.Id.Get(), "") +} + +// CreateStockWarehouse creates a new stock.warehouse model and returns its id. +func (c *Client) CreateStockWarehouse(sw *StockWarehouse) (int64, error) { + return c.Create(StockWarehouseModel, sw) +} + +// UpdateStockWarehouse updates an existing stock.warehouse record. +func (c *Client) UpdateStockWarehouse(sw *StockWarehouse) error { + return c.UpdateStockWarehouses([]int64{sw.Id.Get()}, sw) +} + +// UpdateStockWarehouses updates existing stock.warehouse records. +// All records (represented by ids) will be updated by sw values. +func (c *Client) UpdateStockWarehouses(ids []int64, sw *StockWarehouse) error { + return c.Update(StockWarehouseModel, ids, sw) +} + +// DeleteStockWarehouse deletes an existing stock.warehouse record. +func (c *Client) DeleteStockWarehouse(id int64) error { + return c.DeleteStockWarehouses([]int64{id}) +} + +// DeleteStockWarehouses deletes existing stock.warehouse records. +func (c *Client) DeleteStockWarehouses(ids []int64) error { + return c.Delete(StockWarehouseModel, ids) +} + +// GetStockWarehouse gets stock.warehouse existing record. +func (c *Client) GetStockWarehouse(id int64) (*StockWarehouse, error) { + sws, err := c.GetStockWarehouses([]int64{id}) + if err != nil { + return nil, err + } + if sws != nil && len(*sws) > 0 { + return &((*sws)[0]), nil + } + return nil, fmt.Errorf("id %v of stock.warehouse not found", id) +} + +// GetStockWarehouses gets stock.warehouse existing records. +func (c *Client) GetStockWarehouses(ids []int64) (*StockWarehouses, error) { + sws := &StockWarehouses{} + if err := c.Read(StockWarehouseModel, ids, nil, sws); err != nil { + return nil, err + } + return sws, nil +} + +// FindStockWarehouse finds stock.warehouse record by querying it with criteria. +func (c *Client) FindStockWarehouse(criteria *Criteria) (*StockWarehouse, error) { + sws := &StockWarehouses{} + if err := c.SearchRead(StockWarehouseModel, criteria, NewOptions().Limit(1), sws); err != nil { + return nil, err + } + if sws != nil && len(*sws) > 0 { + return &((*sws)[0]), nil + } + return nil, fmt.Errorf("no stock.warehouse was found with criteria %v", criteria) +} + +// FindStockWarehouses finds stock.warehouse records by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockWarehouses(criteria *Criteria, options *Options) (*StockWarehouses, error) { + sws := &StockWarehouses{} + if err := c.SearchRead(StockWarehouseModel, criteria, options, sws); err != nil { + return nil, err + } + return sws, nil +} + +// FindStockWarehouseIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockWarehouseIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(StockWarehouseModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindStockWarehouseId finds record id by querying it with criteria. +func (c *Client) FindStockWarehouseId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(StockWarehouseModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no stock.warehouse was found with criteria %v and options %v", criteria, options) +} diff --git a/stock_warehouse_orderpoint.go b/stock_warehouse_orderpoint.go new file mode 100644 index 00000000..59819534 --- /dev/null +++ b/stock_warehouse_orderpoint.go @@ -0,0 +1,131 @@ +package odoo + +import ( + "fmt" +) + +// StockWarehouseOrderpoint represents stock.warehouse.orderpoint model. +type StockWarehouseOrderpoint struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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"` + GroupId *Many2One `xmlrpc:"group_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LeadDays *Int `xmlrpc:"lead_days,omitempty"` + LeadType *Selection `xmlrpc:"lead_type,omitempty"` + LocationId *Many2One `xmlrpc:"location_id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + ProductId *Many2One `xmlrpc:"product_id,omitempty"` + ProductMaxQty *Float `xmlrpc:"product_max_qty,omitempty"` + ProductMinQty *Float `xmlrpc:"product_min_qty,omitempty"` + ProductUom *Many2One `xmlrpc:"product_uom,omitempty"` + QtyMultiple *Float `xmlrpc:"qty_multiple,omitempty"` + WarehouseId *Many2One `xmlrpc:"warehouse_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// StockWarehouseOrderpoints represents array of stock.warehouse.orderpoint model. +type StockWarehouseOrderpoints []StockWarehouseOrderpoint + +// StockWarehouseOrderpointModel is the odoo model name. +const StockWarehouseOrderpointModel = "stock.warehouse.orderpoint" + +// Many2One convert StockWarehouseOrderpoint to *Many2One. +func (swo *StockWarehouseOrderpoint) Many2One() *Many2One { + return NewMany2One(swo.Id.Get(), "") +} + +// CreateStockWarehouseOrderpoint creates a new stock.warehouse.orderpoint model and returns its id. +func (c *Client) CreateStockWarehouseOrderpoint(swo *StockWarehouseOrderpoint) (int64, error) { + return c.Create(StockWarehouseOrderpointModel, swo) +} + +// UpdateStockWarehouseOrderpoint updates an existing stock.warehouse.orderpoint record. +func (c *Client) UpdateStockWarehouseOrderpoint(swo *StockWarehouseOrderpoint) error { + return c.UpdateStockWarehouseOrderpoints([]int64{swo.Id.Get()}, swo) +} + +// UpdateStockWarehouseOrderpoints updates existing stock.warehouse.orderpoint records. +// All records (represented by ids) will be updated by swo values. +func (c *Client) UpdateStockWarehouseOrderpoints(ids []int64, swo *StockWarehouseOrderpoint) error { + return c.Update(StockWarehouseOrderpointModel, ids, swo) +} + +// DeleteStockWarehouseOrderpoint deletes an existing stock.warehouse.orderpoint record. +func (c *Client) DeleteStockWarehouseOrderpoint(id int64) error { + return c.DeleteStockWarehouseOrderpoints([]int64{id}) +} + +// DeleteStockWarehouseOrderpoints deletes existing stock.warehouse.orderpoint records. +func (c *Client) DeleteStockWarehouseOrderpoints(ids []int64) error { + return c.Delete(StockWarehouseOrderpointModel, ids) +} + +// GetStockWarehouseOrderpoint gets stock.warehouse.orderpoint existing record. +func (c *Client) GetStockWarehouseOrderpoint(id int64) (*StockWarehouseOrderpoint, error) { + swos, err := c.GetStockWarehouseOrderpoints([]int64{id}) + if err != nil { + return nil, err + } + if swos != nil && len(*swos) > 0 { + return &((*swos)[0]), nil + } + return nil, fmt.Errorf("id %v of stock.warehouse.orderpoint not found", id) +} + +// GetStockWarehouseOrderpoints gets stock.warehouse.orderpoint existing records. +func (c *Client) GetStockWarehouseOrderpoints(ids []int64) (*StockWarehouseOrderpoints, error) { + swos := &StockWarehouseOrderpoints{} + if err := c.Read(StockWarehouseOrderpointModel, ids, nil, swos); err != nil { + return nil, err + } + return swos, nil +} + +// FindStockWarehouseOrderpoint finds stock.warehouse.orderpoint record by querying it with criteria. +func (c *Client) FindStockWarehouseOrderpoint(criteria *Criteria) (*StockWarehouseOrderpoint, error) { + swos := &StockWarehouseOrderpoints{} + if err := c.SearchRead(StockWarehouseOrderpointModel, criteria, NewOptions().Limit(1), swos); err != nil { + return nil, err + } + if swos != nil && len(*swos) > 0 { + return &((*swos)[0]), nil + } + return nil, fmt.Errorf("no stock.warehouse.orderpoint was found with criteria %v", criteria) +} + +// FindStockWarehouseOrderpoints finds stock.warehouse.orderpoint records by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockWarehouseOrderpoints(criteria *Criteria, options *Options) (*StockWarehouseOrderpoints, error) { + swos := &StockWarehouseOrderpoints{} + if err := c.SearchRead(StockWarehouseOrderpointModel, criteria, options, swos); err != nil { + return nil, err + } + return swos, nil +} + +// FindStockWarehouseOrderpointIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockWarehouseOrderpointIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(StockWarehouseOrderpointModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindStockWarehouseOrderpointId finds record id by querying it with criteria. +func (c *Client) FindStockWarehouseOrderpointId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(StockWarehouseOrderpointModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no stock.warehouse.orderpoint was found with criteria %v and options %v", criteria, options) +} diff --git a/stock_warn_insufficient_qty.go b/stock_warn_insufficient_qty.go new file mode 100644 index 00000000..5fb71491 --- /dev/null +++ b/stock_warn_insufficient_qty.go @@ -0,0 +1,117 @@ +package odoo + +import ( + "fmt" +) + +// StockWarnInsufficientQty represents stock.warn.insufficient.qty model. +type StockWarnInsufficientQty struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LocationId *Many2One `xmlrpc:"location_id,omitempty"` + ProductId *Many2One `xmlrpc:"product_id,omitempty"` + QuantIds *Relation `xmlrpc:"quant_ids,omitempty"` +} + +// StockWarnInsufficientQtys represents array of stock.warn.insufficient.qty model. +type StockWarnInsufficientQtys []StockWarnInsufficientQty + +// StockWarnInsufficientQtyModel is the odoo model name. +const StockWarnInsufficientQtyModel = "stock.warn.insufficient.qty" + +// Many2One convert StockWarnInsufficientQty to *Many2One. +func (swiq *StockWarnInsufficientQty) Many2One() *Many2One { + return NewMany2One(swiq.Id.Get(), "") +} + +// CreateStockWarnInsufficientQty creates a new stock.warn.insufficient.qty model and returns its id. +func (c *Client) CreateStockWarnInsufficientQty(swiq *StockWarnInsufficientQty) (int64, error) { + return c.Create(StockWarnInsufficientQtyModel, swiq) +} + +// UpdateStockWarnInsufficientQty updates an existing stock.warn.insufficient.qty record. +func (c *Client) UpdateStockWarnInsufficientQty(swiq *StockWarnInsufficientQty) error { + return c.UpdateStockWarnInsufficientQtys([]int64{swiq.Id.Get()}, swiq) +} + +// UpdateStockWarnInsufficientQtys updates existing stock.warn.insufficient.qty records. +// All records (represented by ids) will be updated by swiq values. +func (c *Client) UpdateStockWarnInsufficientQtys(ids []int64, swiq *StockWarnInsufficientQty) error { + return c.Update(StockWarnInsufficientQtyModel, ids, swiq) +} + +// DeleteStockWarnInsufficientQty deletes an existing stock.warn.insufficient.qty record. +func (c *Client) DeleteStockWarnInsufficientQty(id int64) error { + return c.DeleteStockWarnInsufficientQtys([]int64{id}) +} + +// DeleteStockWarnInsufficientQtys deletes existing stock.warn.insufficient.qty records. +func (c *Client) DeleteStockWarnInsufficientQtys(ids []int64) error { + return c.Delete(StockWarnInsufficientQtyModel, ids) +} + +// GetStockWarnInsufficientQty gets stock.warn.insufficient.qty existing record. +func (c *Client) GetStockWarnInsufficientQty(id int64) (*StockWarnInsufficientQty, error) { + swiqs, err := c.GetStockWarnInsufficientQtys([]int64{id}) + if err != nil { + return nil, err + } + if swiqs != nil && len(*swiqs) > 0 { + return &((*swiqs)[0]), nil + } + return nil, fmt.Errorf("id %v of stock.warn.insufficient.qty not found", id) +} + +// GetStockWarnInsufficientQtys gets stock.warn.insufficient.qty existing records. +func (c *Client) GetStockWarnInsufficientQtys(ids []int64) (*StockWarnInsufficientQtys, error) { + swiqs := &StockWarnInsufficientQtys{} + if err := c.Read(StockWarnInsufficientQtyModel, ids, nil, swiqs); err != nil { + return nil, err + } + return swiqs, nil +} + +// FindStockWarnInsufficientQty finds stock.warn.insufficient.qty record by querying it with criteria. +func (c *Client) FindStockWarnInsufficientQty(criteria *Criteria) (*StockWarnInsufficientQty, error) { + swiqs := &StockWarnInsufficientQtys{} + if err := c.SearchRead(StockWarnInsufficientQtyModel, criteria, NewOptions().Limit(1), swiqs); err != nil { + return nil, err + } + if swiqs != nil && len(*swiqs) > 0 { + return &((*swiqs)[0]), nil + } + return nil, fmt.Errorf("no stock.warn.insufficient.qty was found with criteria %v", criteria) +} + +// FindStockWarnInsufficientQtys finds stock.warn.insufficient.qty records by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockWarnInsufficientQtys(criteria *Criteria, options *Options) (*StockWarnInsufficientQtys, error) { + swiqs := &StockWarnInsufficientQtys{} + if err := c.SearchRead(StockWarnInsufficientQtyModel, criteria, options, swiqs); err != nil { + return nil, err + } + return swiqs, nil +} + +// FindStockWarnInsufficientQtyIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockWarnInsufficientQtyIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(StockWarnInsufficientQtyModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindStockWarnInsufficientQtyId finds record id by querying it with criteria. +func (c *Client) FindStockWarnInsufficientQtyId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(StockWarnInsufficientQtyModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no stock.warn.insufficient.qty was found with criteria %v and options %v", criteria, options) +} diff --git a/stock_warn_insufficient_qty_scrap.go b/stock_warn_insufficient_qty_scrap.go new file mode 100644 index 00000000..5b3db32f --- /dev/null +++ b/stock_warn_insufficient_qty_scrap.go @@ -0,0 +1,122 @@ +package odoo + +import ( + "fmt" +) + +// StockWarnInsufficientQtyScrap represents stock.warn.insufficient.qty.scrap model. +type StockWarnInsufficientQtyScrap struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LocationId *Many2One `xmlrpc:"location_id,omitempty"` + ProductId *Many2One `xmlrpc:"product_id,omitempty"` + QuantIds *Relation `xmlrpc:"quant_ids,omitempty"` + ScrapId *Many2One `xmlrpc:"scrap_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// StockWarnInsufficientQtyScraps represents array of stock.warn.insufficient.qty.scrap model. +type StockWarnInsufficientQtyScraps []StockWarnInsufficientQtyScrap + +// StockWarnInsufficientQtyScrapModel is the odoo model name. +const StockWarnInsufficientQtyScrapModel = "stock.warn.insufficient.qty.scrap" + +// Many2One convert StockWarnInsufficientQtyScrap to *Many2One. +func (swiqs *StockWarnInsufficientQtyScrap) Many2One() *Many2One { + return NewMany2One(swiqs.Id.Get(), "") +} + +// CreateStockWarnInsufficientQtyScrap creates a new stock.warn.insufficient.qty.scrap model and returns its id. +func (c *Client) CreateStockWarnInsufficientQtyScrap(swiqs *StockWarnInsufficientQtyScrap) (int64, error) { + return c.Create(StockWarnInsufficientQtyScrapModel, swiqs) +} + +// UpdateStockWarnInsufficientQtyScrap updates an existing stock.warn.insufficient.qty.scrap record. +func (c *Client) UpdateStockWarnInsufficientQtyScrap(swiqs *StockWarnInsufficientQtyScrap) error { + return c.UpdateStockWarnInsufficientQtyScraps([]int64{swiqs.Id.Get()}, swiqs) +} + +// UpdateStockWarnInsufficientQtyScraps updates existing stock.warn.insufficient.qty.scrap records. +// All records (represented by ids) will be updated by swiqs values. +func (c *Client) UpdateStockWarnInsufficientQtyScraps(ids []int64, swiqs *StockWarnInsufficientQtyScrap) error { + return c.Update(StockWarnInsufficientQtyScrapModel, ids, swiqs) +} + +// DeleteStockWarnInsufficientQtyScrap deletes an existing stock.warn.insufficient.qty.scrap record. +func (c *Client) DeleteStockWarnInsufficientQtyScrap(id int64) error { + return c.DeleteStockWarnInsufficientQtyScraps([]int64{id}) +} + +// DeleteStockWarnInsufficientQtyScraps deletes existing stock.warn.insufficient.qty.scrap records. +func (c *Client) DeleteStockWarnInsufficientQtyScraps(ids []int64) error { + return c.Delete(StockWarnInsufficientQtyScrapModel, ids) +} + +// GetStockWarnInsufficientQtyScrap gets stock.warn.insufficient.qty.scrap existing record. +func (c *Client) GetStockWarnInsufficientQtyScrap(id int64) (*StockWarnInsufficientQtyScrap, error) { + swiqss, err := c.GetStockWarnInsufficientQtyScraps([]int64{id}) + if err != nil { + return nil, err + } + if swiqss != nil && len(*swiqss) > 0 { + return &((*swiqss)[0]), nil + } + return nil, fmt.Errorf("id %v of stock.warn.insufficient.qty.scrap not found", id) +} + +// GetStockWarnInsufficientQtyScraps gets stock.warn.insufficient.qty.scrap existing records. +func (c *Client) GetStockWarnInsufficientQtyScraps(ids []int64) (*StockWarnInsufficientQtyScraps, error) { + swiqss := &StockWarnInsufficientQtyScraps{} + if err := c.Read(StockWarnInsufficientQtyScrapModel, ids, nil, swiqss); err != nil { + return nil, err + } + return swiqss, nil +} + +// FindStockWarnInsufficientQtyScrap finds stock.warn.insufficient.qty.scrap record by querying it with criteria. +func (c *Client) FindStockWarnInsufficientQtyScrap(criteria *Criteria) (*StockWarnInsufficientQtyScrap, error) { + swiqss := &StockWarnInsufficientQtyScraps{} + if err := c.SearchRead(StockWarnInsufficientQtyScrapModel, criteria, NewOptions().Limit(1), swiqss); err != nil { + return nil, err + } + if swiqss != nil && len(*swiqss) > 0 { + return &((*swiqss)[0]), nil + } + return nil, fmt.Errorf("no stock.warn.insufficient.qty.scrap was found with criteria %v", criteria) +} + +// FindStockWarnInsufficientQtyScraps finds stock.warn.insufficient.qty.scrap records by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockWarnInsufficientQtyScraps(criteria *Criteria, options *Options) (*StockWarnInsufficientQtyScraps, error) { + swiqss := &StockWarnInsufficientQtyScraps{} + if err := c.SearchRead(StockWarnInsufficientQtyScrapModel, criteria, options, swiqss); err != nil { + return nil, err + } + return swiqss, nil +} + +// FindStockWarnInsufficientQtyScrapIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindStockWarnInsufficientQtyScrapIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(StockWarnInsufficientQtyScrapModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindStockWarnInsufficientQtyScrapId finds record id by querying it with criteria. +func (c *Client) FindStockWarnInsufficientQtyScrapId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(StockWarnInsufficientQtyScrapModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no stock.warn.insufficient.qty.scrap was found with criteria %v and options %v", criteria, options) +} diff --git a/tax_adjustments_wizard.go b/tax_adjustments_wizard.go new file mode 100644 index 00000000..9cb021bd --- /dev/null +++ b/tax_adjustments_wizard.go @@ -0,0 +1,127 @@ +package odoo + +import ( + "fmt" +) + +// TaxAdjustmentsWizard represents tax.adjustments.wizard model. +type TaxAdjustmentsWizard struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + AdjustmentType *Selection `xmlrpc:"adjustment_type,omitempty"` + Amount *Float `xmlrpc:"amount,omitempty"` + CompanyCurrencyId *Many2One `xmlrpc:"company_currency_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CreditAccountId *Many2One `xmlrpc:"credit_account_id,omitempty"` + Date *Time `xmlrpc:"date,omitempty"` + DebitAccountId *Many2One `xmlrpc:"debit_account_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + JournalId *Many2One `xmlrpc:"journal_id,omitempty"` + Reason *String `xmlrpc:"reason,omitempty"` + TaxId *Many2One `xmlrpc:"tax_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// TaxAdjustmentsWizards represents array of tax.adjustments.wizard model. +type TaxAdjustmentsWizards []TaxAdjustmentsWizard + +// TaxAdjustmentsWizardModel is the odoo model name. +const TaxAdjustmentsWizardModel = "tax.adjustments.wizard" + +// Many2One convert TaxAdjustmentsWizard to *Many2One. +func (taw *TaxAdjustmentsWizard) Many2One() *Many2One { + return NewMany2One(taw.Id.Get(), "") +} + +// CreateTaxAdjustmentsWizard creates a new tax.adjustments.wizard model and returns its id. +func (c *Client) CreateTaxAdjustmentsWizard(taw *TaxAdjustmentsWizard) (int64, error) { + return c.Create(TaxAdjustmentsWizardModel, taw) +} + +// UpdateTaxAdjustmentsWizard updates an existing tax.adjustments.wizard record. +func (c *Client) UpdateTaxAdjustmentsWizard(taw *TaxAdjustmentsWizard) error { + return c.UpdateTaxAdjustmentsWizards([]int64{taw.Id.Get()}, taw) +} + +// UpdateTaxAdjustmentsWizards updates existing tax.adjustments.wizard records. +// All records (represented by ids) will be updated by taw values. +func (c *Client) UpdateTaxAdjustmentsWizards(ids []int64, taw *TaxAdjustmentsWizard) error { + return c.Update(TaxAdjustmentsWizardModel, ids, taw) +} + +// DeleteTaxAdjustmentsWizard deletes an existing tax.adjustments.wizard record. +func (c *Client) DeleteTaxAdjustmentsWizard(id int64) error { + return c.DeleteTaxAdjustmentsWizards([]int64{id}) +} + +// DeleteTaxAdjustmentsWizards deletes existing tax.adjustments.wizard records. +func (c *Client) DeleteTaxAdjustmentsWizards(ids []int64) error { + return c.Delete(TaxAdjustmentsWizardModel, ids) +} + +// GetTaxAdjustmentsWizard gets tax.adjustments.wizard existing record. +func (c *Client) GetTaxAdjustmentsWizard(id int64) (*TaxAdjustmentsWizard, error) { + taws, err := c.GetTaxAdjustmentsWizards([]int64{id}) + if err != nil { + return nil, err + } + if taws != nil && len(*taws) > 0 { + return &((*taws)[0]), nil + } + return nil, fmt.Errorf("id %v of tax.adjustments.wizard not found", id) +} + +// GetTaxAdjustmentsWizards gets tax.adjustments.wizard existing records. +func (c *Client) GetTaxAdjustmentsWizards(ids []int64) (*TaxAdjustmentsWizards, error) { + taws := &TaxAdjustmentsWizards{} + if err := c.Read(TaxAdjustmentsWizardModel, ids, nil, taws); err != nil { + return nil, err + } + return taws, nil +} + +// FindTaxAdjustmentsWizard finds tax.adjustments.wizard record by querying it with criteria. +func (c *Client) FindTaxAdjustmentsWizard(criteria *Criteria) (*TaxAdjustmentsWizard, error) { + taws := &TaxAdjustmentsWizards{} + if err := c.SearchRead(TaxAdjustmentsWizardModel, criteria, NewOptions().Limit(1), taws); err != nil { + return nil, err + } + if taws != nil && len(*taws) > 0 { + return &((*taws)[0]), nil + } + return nil, fmt.Errorf("no tax.adjustments.wizard was found with criteria %v", criteria) +} + +// FindTaxAdjustmentsWizards finds tax.adjustments.wizard records by querying it +// and filtering it with criteria and options. +func (c *Client) FindTaxAdjustmentsWizards(criteria *Criteria, options *Options) (*TaxAdjustmentsWizards, error) { + taws := &TaxAdjustmentsWizards{} + if err := c.SearchRead(TaxAdjustmentsWizardModel, criteria, options, taws); err != nil { + return nil, err + } + return taws, nil +} + +// FindTaxAdjustmentsWizardIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindTaxAdjustmentsWizardIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(TaxAdjustmentsWizardModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindTaxAdjustmentsWizardId finds record id by querying it with criteria. +func (c *Client) FindTaxAdjustmentsWizardId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(TaxAdjustmentsWizardModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no tax.adjustments.wizard was found with criteria %v and options %v", criteria, options) +} diff --git a/utm_campaign.go b/utm_campaign.go new file mode 100644 index 00000000..32c00752 --- /dev/null +++ b/utm_campaign.go @@ -0,0 +1,119 @@ +package odoo + +import ( + "fmt" +) + +// UtmCampaign represents utm.campaign model. +type UtmCampaign struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` +} + +// 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) { + return c.Create(UtmCampaignModel, uc) +} + +// 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) +} + +// 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 + } + if ucs != nil && len(*ucs) > 0 { + return &((*ucs)[0]), nil + } + return nil, fmt.Errorf("id %v of utm.campaign not found", id) +} + +// 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 + } + if ucs != nil && len(*ucs) > 0 { + return &((*ucs)[0]), nil + } + return nil, fmt.Errorf("no utm.campaign was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(UtmCampaignModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no utm.campaign was found with criteria %v and options %v", criteria, options) +} diff --git a/utm_medium.go b/utm_medium.go new file mode 100644 index 00000000..01a18329 --- /dev/null +++ b/utm_medium.go @@ -0,0 +1,120 @@ +package odoo + +import ( + "fmt" +) + +// UtmMedium represents utm.medium model. +type UtmMedium struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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) { + return c.Create(UtmMediumModel, um) +} + +// 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) +} + +// 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 + } + if ums != nil && len(*ums) > 0 { + return &((*ums)[0]), nil + } + return nil, fmt.Errorf("id %v of utm.medium not found", id) +} + +// 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 + } + if ums != nil && len(*ums) > 0 { + return &((*ums)[0]), nil + } + return nil, fmt.Errorf("no utm.medium was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(UtmMediumModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no utm.medium was found with criteria %v and options %v", criteria, options) +} diff --git a/utm_mixin.go b/utm_mixin.go new file mode 100644 index 00000000..a053be7b --- /dev/null +++ b/utm_mixin.go @@ -0,0 +1,117 @@ +package odoo + +import ( + "fmt" +) + +// UtmMixin represents utm.mixin model. +type UtmMixin struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + CampaignId *Many2One `xmlrpc:"campaign_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + MediumId *Many2One `xmlrpc:"medium_id,omitempty"` + SourceId *Many2One `xmlrpc:"source_id,omitempty"` +} + +// UtmMixins represents array of utm.mixin model. +type UtmMixins []UtmMixin + +// UtmMixinModel is the odoo model name. +const UtmMixinModel = "utm.mixin" + +// Many2One convert UtmMixin to *Many2One. +func (um *UtmMixin) Many2One() *Many2One { + return NewMany2One(um.Id.Get(), "") +} + +// CreateUtmMixin creates a new utm.mixin model and returns its id. +func (c *Client) CreateUtmMixin(um *UtmMixin) (int64, error) { + return c.Create(UtmMixinModel, um) +} + +// UpdateUtmMixin updates an existing utm.mixin record. +func (c *Client) UpdateUtmMixin(um *UtmMixin) error { + return c.UpdateUtmMixins([]int64{um.Id.Get()}, um) +} + +// UpdateUtmMixins updates existing utm.mixin records. +// All records (represented by ids) will be updated by um values. +func (c *Client) UpdateUtmMixins(ids []int64, um *UtmMixin) error { + return c.Update(UtmMixinModel, ids, um) +} + +// DeleteUtmMixin deletes an existing utm.mixin record. +func (c *Client) DeleteUtmMixin(id int64) error { + return c.DeleteUtmMixins([]int64{id}) +} + +// DeleteUtmMixins deletes existing utm.mixin records. +func (c *Client) DeleteUtmMixins(ids []int64) error { + return c.Delete(UtmMixinModel, ids) +} + +// GetUtmMixin gets utm.mixin existing record. +func (c *Client) GetUtmMixin(id int64) (*UtmMixin, error) { + ums, err := c.GetUtmMixins([]int64{id}) + if err != nil { + return nil, err + } + if ums != nil && len(*ums) > 0 { + return &((*ums)[0]), nil + } + return nil, fmt.Errorf("id %v of utm.mixin not found", id) +} + +// GetUtmMixins gets utm.mixin existing records. +func (c *Client) GetUtmMixins(ids []int64) (*UtmMixins, error) { + ums := &UtmMixins{} + if err := c.Read(UtmMixinModel, ids, nil, ums); err != nil { + return nil, err + } + return ums, nil +} + +// FindUtmMixin finds utm.mixin record by querying it with criteria. +func (c *Client) FindUtmMixin(criteria *Criteria) (*UtmMixin, error) { + ums := &UtmMixins{} + if err := c.SearchRead(UtmMixinModel, criteria, NewOptions().Limit(1), ums); err != nil { + return nil, err + } + if ums != nil && len(*ums) > 0 { + return &((*ums)[0]), nil + } + return nil, fmt.Errorf("no utm.mixin was found with criteria %v", criteria) +} + +// FindUtmMixins finds utm.mixin records by querying it +// and filtering it with criteria and options. +func (c *Client) FindUtmMixins(criteria *Criteria, options *Options) (*UtmMixins, error) { + ums := &UtmMixins{} + if err := c.SearchRead(UtmMixinModel, criteria, options, ums); err != nil { + return nil, err + } + return ums, nil +} + +// FindUtmMixinIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindUtmMixinIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(UtmMixinModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindUtmMixinId finds record id by querying it with criteria. +func (c *Client) FindUtmMixinId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(UtmMixinModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no utm.mixin was found with criteria %v and options %v", criteria, options) +} diff --git a/utm_source.go b/utm_source.go new file mode 100644 index 00000000..1d51119d --- /dev/null +++ b/utm_source.go @@ -0,0 +1,119 @@ +package odoo + +import ( + "fmt" +) + +// UtmSource represents utm.source model. +type UtmSource struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` +} + +// 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) { + return c.Create(UtmSourceModel, us) +} + +// 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) +} + +// 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 + } + if uss != nil && len(*uss) > 0 { + return &((*uss)[0]), nil + } + return nil, fmt.Errorf("id %v of utm.source not found", id) +} + +// 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 + } + if uss != nil && len(*uss) > 0 { + return &((*uss)[0]), nil + } + return nil, fmt.Errorf("no utm.source was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(UtmSourceModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no utm.source was found with criteria %v and options %v", criteria, options) +} diff --git a/validate_account_move.go b/validate_account_move.go new file mode 100644 index 00000000..30eb2625 --- /dev/null +++ b/validate_account_move.go @@ -0,0 +1,118 @@ +package odoo + +import ( + "fmt" +) + +// ValidateAccountMove represents validate.account.move model. +type ValidateAccountMove struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` +} + +// 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) { + return c.Create(ValidateAccountMoveModel, vam) +} + +// 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) +} + +// 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 + } + if vams != nil && len(*vams) > 0 { + return &((*vams)[0]), nil + } + return nil, fmt.Errorf("id %v of validate.account.move not found", id) +} + +// 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 + } + if vams != nil && len(*vams) > 0 { + return &((*vams)[0]), nil + } + return nil, fmt.Errorf("no validate.account.move was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(ValidateAccountMoveModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no validate.account.move was found with criteria %v and options %v", criteria, options) +} diff --git a/web_editor_converter_test.go b/web_editor_converter_test.go new file mode 100644 index 00000000..d2d36d99 --- /dev/null +++ b/web_editor_converter_test.go @@ -0,0 +1,130 @@ +package odoo + +import ( + "fmt" +) + +// WebEditorConverterTest represents web_editor.converter.test model. +type WebEditorConverterTest struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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"` + Selection *Selection `xmlrpc:"selection,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) { + return c.Create(WebEditorConverterTestModel, wct) +} + +// 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) +} + +// 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 + } + if wcts != nil && len(*wcts) > 0 { + return &((*wcts)[0]), nil + } + return nil, fmt.Errorf("id %v of web_editor.converter.test not found", id) +} + +// 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 + } + if wcts != nil && len(*wcts) > 0 { + return &((*wcts)[0]), nil + } + return nil, fmt.Errorf("no web_editor.converter.test was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(WebEditorConverterTestModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no web_editor.converter.test was found with criteria %v and options %v", criteria, options) +} diff --git a/web_editor_converter_test_sub.go b/web_editor_converter_test_sub.go new file mode 100644 index 00000000..4652be39 --- /dev/null +++ b/web_editor_converter_test_sub.go @@ -0,0 +1,119 @@ +package odoo + +import ( + "fmt" +) + +// WebEditorConverterTestSub represents web_editor.converter.test.sub model. +type WebEditorConverterTestSub struct { + LastUpdate *Time `xmlrpc:"__last_update,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"` +} + +// 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) { + return c.Create(WebEditorConverterTestSubModel, wcts) +} + +// 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) +} + +// 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 + } + if wctss != nil && len(*wctss) > 0 { + return &((*wctss)[0]), nil + } + return nil, fmt.Errorf("id %v of web_editor.converter.test.sub not found", id) +} + +// 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 + } + if wctss != nil && len(*wctss) > 0 { + return &((*wctss)[0]), nil + } + return nil, fmt.Errorf("no web_editor.converter.test.sub was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(WebEditorConverterTestSubModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no web_editor.converter.test.sub was found with criteria %v and options %v", criteria, options) +} diff --git a/web_planner.go b/web_planner.go new file mode 100644 index 00000000..29fe4d59 --- /dev/null +++ b/web_planner.go @@ -0,0 +1,126 @@ +package odoo + +import ( + "fmt" +) + +// WebPlanner represents web.planner model. +type WebPlanner struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + Active *Bool `xmlrpc:"active,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Data *String `xmlrpc:"data,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + MenuId *Many2One `xmlrpc:"menu_id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + PlannerApplication *Selection `xmlrpc:"planner_application,omitempty"` + Progress *Int `xmlrpc:"progress,omitempty"` + TooltipPlanner *String `xmlrpc:"tooltip_planner,omitempty"` + ViewId *Many2One `xmlrpc:"view_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// WebPlanners represents array of web.planner model. +type WebPlanners []WebPlanner + +// WebPlannerModel is the odoo model name. +const WebPlannerModel = "web.planner" + +// Many2One convert WebPlanner to *Many2One. +func (wp *WebPlanner) Many2One() *Many2One { + return NewMany2One(wp.Id.Get(), "") +} + +// CreateWebPlanner creates a new web.planner model and returns its id. +func (c *Client) CreateWebPlanner(wp *WebPlanner) (int64, error) { + return c.Create(WebPlannerModel, wp) +} + +// UpdateWebPlanner updates an existing web.planner record. +func (c *Client) UpdateWebPlanner(wp *WebPlanner) error { + return c.UpdateWebPlanners([]int64{wp.Id.Get()}, wp) +} + +// UpdateWebPlanners updates existing web.planner records. +// All records (represented by ids) will be updated by wp values. +func (c *Client) UpdateWebPlanners(ids []int64, wp *WebPlanner) error { + return c.Update(WebPlannerModel, ids, wp) +} + +// DeleteWebPlanner deletes an existing web.planner record. +func (c *Client) DeleteWebPlanner(id int64) error { + return c.DeleteWebPlanners([]int64{id}) +} + +// DeleteWebPlanners deletes existing web.planner records. +func (c *Client) DeleteWebPlanners(ids []int64) error { + return c.Delete(WebPlannerModel, ids) +} + +// GetWebPlanner gets web.planner existing record. +func (c *Client) GetWebPlanner(id int64) (*WebPlanner, error) { + wps, err := c.GetWebPlanners([]int64{id}) + if err != nil { + return nil, err + } + if wps != nil && len(*wps) > 0 { + return &((*wps)[0]), nil + } + return nil, fmt.Errorf("id %v of web.planner not found", id) +} + +// GetWebPlanners gets web.planner existing records. +func (c *Client) GetWebPlanners(ids []int64) (*WebPlanners, error) { + wps := &WebPlanners{} + if err := c.Read(WebPlannerModel, ids, nil, wps); err != nil { + return nil, err + } + return wps, nil +} + +// FindWebPlanner finds web.planner record by querying it with criteria. +func (c *Client) FindWebPlanner(criteria *Criteria) (*WebPlanner, error) { + wps := &WebPlanners{} + if err := c.SearchRead(WebPlannerModel, criteria, NewOptions().Limit(1), wps); err != nil { + return nil, err + } + if wps != nil && len(*wps) > 0 { + return &((*wps)[0]), nil + } + return nil, fmt.Errorf("no web.planner was found with criteria %v", criteria) +} + +// FindWebPlanners finds web.planner records by querying it +// and filtering it with criteria and options. +func (c *Client) FindWebPlanners(criteria *Criteria, options *Options) (*WebPlanners, error) { + wps := &WebPlanners{} + if err := c.SearchRead(WebPlannerModel, criteria, options, wps); err != nil { + return nil, err + } + return wps, nil +} + +// FindWebPlannerIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindWebPlannerIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(WebPlannerModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindWebPlannerId finds record id by querying it with criteria. +func (c *Client) FindWebPlannerId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(WebPlannerModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no web.planner was found with criteria %v and options %v", criteria, options) +} diff --git a/web_tour_tour.go b/web_tour_tour.go new file mode 100644 index 00000000..d58c3b74 --- /dev/null +++ b/web_tour_tour.go @@ -0,0 +1,116 @@ +package odoo + +import ( + "fmt" +) + +// WebTourTour represents web_tour.tour model. +type WebTourTour struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + UserId *Many2One `xmlrpc:"user_id,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) { + return c.Create(WebTourTourModel, wt) +} + +// 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) +} + +// 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 + } + if wts != nil && len(*wts) > 0 { + return &((*wts)[0]), nil + } + return nil, fmt.Errorf("id %v of web_tour.tour not found", id) +} + +// 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 + } + if wts != nil && len(*wts) > 0 { + return &((*wts)[0]), nil + } + return nil, fmt.Errorf("no web_tour.tour was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(WebTourTourModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no web_tour.tour was found with criteria %v and options %v", criteria, options) +} diff --git a/wizard_ir_model_menu_create.go b/wizard_ir_model_menu_create.go new file mode 100644 index 00000000..968fae83 --- /dev/null +++ b/wizard_ir_model_menu_create.go @@ -0,0 +1,120 @@ +package odoo + +import ( + "fmt" +) + +// WizardIrModelMenuCreate represents wizard.ir.model.menu.create model. +type WizardIrModelMenuCreate struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + 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) { + return c.Create(WizardIrModelMenuCreateModel, wimmc) +} + +// 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) +} + +// 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 + } + if wimmcs != nil && len(*wimmcs) > 0 { + return &((*wimmcs)[0]), nil + } + return nil, fmt.Errorf("id %v of wizard.ir.model.menu.create not found", id) +} + +// 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 + } + if wimmcs != nil && len(*wimmcs) > 0 { + return &((*wimmcs)[0]), nil + } + return nil, fmt.Errorf("no wizard.ir.model.menu.create was found with criteria %v", criteria) +} + +// 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) { + ids, err := c.Search(WizardIrModelMenuCreateModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// 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 + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no wizard.ir.model.menu.create was found with criteria %v and options %v", criteria, options) +} diff --git a/wizard_multi_charts_accounts.go b/wizard_multi_charts_accounts.go new file mode 100644 index 00000000..1db79717 --- /dev/null +++ b/wizard_multi_charts_accounts.go @@ -0,0 +1,133 @@ +package odoo + +import ( + "fmt" +) + +// WizardMultiChartsAccounts represents wizard.multi.charts.accounts model. +type WizardMultiChartsAccounts struct { + LastUpdate *Time `xmlrpc:"__last_update,omitempty"` + BankAccountCodePrefix *String `xmlrpc:"bank_account_code_prefix,omitempty"` + BankAccountIds *Relation `xmlrpc:"bank_account_ids,omitempty"` + CashAccountCodePrefix *String `xmlrpc:"cash_account_code_prefix,omitempty"` + ChartTemplateId *Many2One `xmlrpc:"chart_template_id,omitempty"` + CodeDigits *Int `xmlrpc:"code_digits,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CompleteTaxSet *Bool `xmlrpc:"complete_tax_set,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"` + OnlyOneChartTemplate *Bool `xmlrpc:"only_one_chart_template,omitempty"` + PurchaseTaxId *Many2One `xmlrpc:"purchase_tax_id,omitempty"` + PurchaseTaxRate *Float `xmlrpc:"purchase_tax_rate,omitempty"` + SaleTaxId *Many2One `xmlrpc:"sale_tax_id,omitempty"` + SaleTaxRate *Float `xmlrpc:"sale_tax_rate,omitempty"` + TransferAccountId *Many2One `xmlrpc:"transfer_account_id,omitempty"` + UseAngloSaxon *Bool `xmlrpc:"use_anglo_saxon,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// WizardMultiChartsAccountss represents array of wizard.multi.charts.accounts model. +type WizardMultiChartsAccountss []WizardMultiChartsAccounts + +// WizardMultiChartsAccountsModel is the odoo model name. +const WizardMultiChartsAccountsModel = "wizard.multi.charts.accounts" + +// Many2One convert WizardMultiChartsAccounts to *Many2One. +func (wmca *WizardMultiChartsAccounts) Many2One() *Many2One { + return NewMany2One(wmca.Id.Get(), "") +} + +// CreateWizardMultiChartsAccounts creates a new wizard.multi.charts.accounts model and returns its id. +func (c *Client) CreateWizardMultiChartsAccounts(wmca *WizardMultiChartsAccounts) (int64, error) { + return c.Create(WizardMultiChartsAccountsModel, wmca) +} + +// UpdateWizardMultiChartsAccounts updates an existing wizard.multi.charts.accounts record. +func (c *Client) UpdateWizardMultiChartsAccounts(wmca *WizardMultiChartsAccounts) error { + return c.UpdateWizardMultiChartsAccountss([]int64{wmca.Id.Get()}, wmca) +} + +// UpdateWizardMultiChartsAccountss updates existing wizard.multi.charts.accounts records. +// All records (represented by ids) will be updated by wmca values. +func (c *Client) UpdateWizardMultiChartsAccountss(ids []int64, wmca *WizardMultiChartsAccounts) error { + return c.Update(WizardMultiChartsAccountsModel, ids, wmca) +} + +// DeleteWizardMultiChartsAccounts deletes an existing wizard.multi.charts.accounts record. +func (c *Client) DeleteWizardMultiChartsAccounts(id int64) error { + return c.DeleteWizardMultiChartsAccountss([]int64{id}) +} + +// DeleteWizardMultiChartsAccountss deletes existing wizard.multi.charts.accounts records. +func (c *Client) DeleteWizardMultiChartsAccountss(ids []int64) error { + return c.Delete(WizardMultiChartsAccountsModel, ids) +} + +// GetWizardMultiChartsAccounts gets wizard.multi.charts.accounts existing record. +func (c *Client) GetWizardMultiChartsAccounts(id int64) (*WizardMultiChartsAccounts, error) { + wmcas, err := c.GetWizardMultiChartsAccountss([]int64{id}) + if err != nil { + return nil, err + } + if wmcas != nil && len(*wmcas) > 0 { + return &((*wmcas)[0]), nil + } + return nil, fmt.Errorf("id %v of wizard.multi.charts.accounts not found", id) +} + +// GetWizardMultiChartsAccountss gets wizard.multi.charts.accounts existing records. +func (c *Client) GetWizardMultiChartsAccountss(ids []int64) (*WizardMultiChartsAccountss, error) { + wmcas := &WizardMultiChartsAccountss{} + if err := c.Read(WizardMultiChartsAccountsModel, ids, nil, wmcas); err != nil { + return nil, err + } + return wmcas, nil +} + +// FindWizardMultiChartsAccounts finds wizard.multi.charts.accounts record by querying it with criteria. +func (c *Client) FindWizardMultiChartsAccounts(criteria *Criteria) (*WizardMultiChartsAccounts, error) { + wmcas := &WizardMultiChartsAccountss{} + if err := c.SearchRead(WizardMultiChartsAccountsModel, criteria, NewOptions().Limit(1), wmcas); err != nil { + return nil, err + } + if wmcas != nil && len(*wmcas) > 0 { + return &((*wmcas)[0]), nil + } + return nil, fmt.Errorf("no wizard.multi.charts.accounts was found with criteria %v", criteria) +} + +// FindWizardMultiChartsAccountss finds wizard.multi.charts.accounts records by querying it +// and filtering it with criteria and options. +func (c *Client) FindWizardMultiChartsAccountss(criteria *Criteria, options *Options) (*WizardMultiChartsAccountss, error) { + wmcas := &WizardMultiChartsAccountss{} + if err := c.SearchRead(WizardMultiChartsAccountsModel, criteria, options, wmcas); err != nil { + return nil, err + } + return wmcas, nil +} + +// FindWizardMultiChartsAccountsIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindWizardMultiChartsAccountsIds(criteria *Criteria, options *Options) ([]int64, error) { + ids, err := c.Search(WizardMultiChartsAccountsModel, criteria, options) + if err != nil { + return []int64{}, err + } + return ids, nil +} + +// FindWizardMultiChartsAccountsId finds record id by querying it with criteria. +func (c *Client) FindWizardMultiChartsAccountsId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(WizardMultiChartsAccountsModel, criteria, options) + if err != nil { + return -1, err + } + if len(ids) > 0 { + return ids[0], nil + } + return -1, fmt.Errorf("no wizard.multi.charts.accounts was found with criteria %v and options %v", criteria, options) +}