Repository
OCA/connector-interfaces · module folder · Try on Runboat
Module version
1.0.0
Category
Connector
Folder size
0.34 MB
License
AGPL-3
Application
No
Auto-installable
No
Website
https://github.com/OCA/connector-interfaces
Last tracking update
2026-08-07 09:06:36
Authors
Camptocamp, Odoo Community Association (OCA)
Maintainers
Camptocamp, Odoo Community Association (OCA)
Committers
Aungkokolin1997, OCA-git-bot, oca-ci
Odoo dependencies
OCA/connector:
OCA/queue:
odoo/odoo:
- web
- bus
Python dependencies
chardet, pytz, pyyaml, openupgradelib, requests, cachetools
System dependencies
None
Required by
None
Description
This module allows to import / update records from files using the connector
framework and job queue.

To run an import you need at least:

* a backend, hosts the global configuration of the import.
* a recordset, hosts the configuration of the import for specific models and source
* a source, provides the data to import
* an import type, describes which models you want to import and how to import them

Code Analysis

Views touched (14)
XML IDNameModelTypeStatus
recordset_docs Import Recordset Docs ir.ui.view qweb New
recordset_report Import Recordset Report ir.ui.view qweb New
recordset_report_full Import Recordset FUll Report ir.ui.view qweb New
source_config_summary Source config summary ir.ui.view qweb New
view_import_backend_form import.backend form New
view_import_backend_tree import.backend list New
view_import_recordset_form import.recordset form New
view_import_recordset_search import.recordset search New
view_import_recordset_tree import.recordset list New
view_import_source_csv_form import.source.csv form import.source.csv form Inherits view_import_source_form
view_import_source_csv_tree import.source.csv tree import.source.csv list New
view_import_source_form import.source base form import.source form New
view_import_type_form connector_importer: import.type.csv form import.type form New
view_import_type_tree import.type list New
HTTP endpoints (1)
Route(s)HandlerAuthTypeMethodsFlags
/importer/import-recordset/<model("import.recordset"):recordset> ReportController.full_report user http ALL
Models touched (11)

New fields (5)
  • cron_id Many2one → ir.cron
    domain=<expr> string='Related cron' args: 'ir.cron'
  • cron_interval_number Integer
    args: 'Interval number'
  • cron_interval_type Selection
    selection='_select_interval_type' string='Interval type'
  • cron_mode Boolean
    args: 'Cron mode?'
  • cron_start_date Datetime
    args: 'Start date'
Public methods (4)
  • create(self, vals_list)
    @api.model_create_multi
  • get_cron_vals(self)
    @api.model
  • run_cron(self)
    @api.model
  • write(self, vals)

New fields (8)
  • cron_cleanup_keep Integer
    help='If this value is greater than 0 a cron will cleanup old recordsets and keep only the latest N records matching this value.'
  • cron_master_recordset_id Many2one → import.recordset
    help='If an existing recordset is selected it will be used to create a new recordset each time the cron runs. \nIn this way you can keep every import session isolated. \nIf none, all recordsets will run.' string='Master recordset' args: 'import.recordset'
  • debug_mode Boolean
    help="Enabling debug mode causes the import to run in real time, without using any job queue. Make sure you don't do this in production!" args: 'Debug mode?'
  • job_running Boolean
    compute='_compute_job_running' help='Tells you if a job is running for this backend.' readonly=True
  • name Char
    required=True
  • notes Text
  • recordset_ids One2many → import.recordset
    string='Record Sets' args: 'import.recordset', 'backend_id'
  • version Selection
    required=True selection='_select_version'
Public methods (5)
  • button_complete_jobs(self)
    Set all jobs to "completed" state.
  • cron_cleanup_recordsets(self)
    @api.model
    Delete obsolete recordsets. If you are running imports via cron and you create one recorset per each run then you might end up w/ tons of old recordsets. You can use `cron_cleanup_keep` to enable auto-cleanup. Here we lookup for backends w/ this settings and keep only latest recordsets.
  • run_all(self)
    Run all recordset imports.
  • run_cron(self, backend_id)
    @api.model
  • unlink(self)
    Prevent delete if jobs are running.

New fields (4)
  • backend_id Many2one → import.backend
    readonly=True related='recordset_id.backend_id' string='Backend' args: 'import.backend'
  • date Datetime
    default=fields.Datetime.now args: 'Import date'
  • jsondata_file Binary
    attachment=True
  • recordset_id Many2one → import.recordset
    string='Recordset' args: 'import.recordset'
Public methods (5)
  • debug_mode(self)
  • get_data(self)
  • import_record(self, importer_config)
    This job will import a record. # TODO rewrite :param component_name: name of the importer component to use :param model_name: name of the model to import :param is_last_importer: flag for last importer of the recordset
  • run_import(self)
    Queue a job for importing data stored in to self
  • set_data(self, adict)

New fields (21)
  • backend_id Many2one → import.backend
    string='Import Backend' args: 'import.backend'
  • create_date Datetime
  • docs_html Html
    compute='_compute_docs_html' string='Docs'
  • full_report_url Char
    compute='_compute_full_report_url'
  • import_type_id Many2one → import.type
    comodel_name='import.type' required=True string='Import type'
  • importable_model_ids Many2many → ir.model
    column1='recordset_id' column2='model_id' comodel_name='ir.model' compute='_compute_importable_model_ids' help='Technical field' relation='import_recordset_importable_model'
  • jobs_global_state Selection
    compute='_compute_jobs_global_state' default='no_job' help='Tells you if a job is running for this recordset. If any of the sub jobs is not DONE or FAILED we assume the global state is PENDING.' selection=<expr>
  • last_run_on Datetime
  • name Char
    compute='_compute_name'
  • notes Html
    help='Useful info for your users'
  • override_existing Boolean
    default=True help='Enable to update existing items w/ new values. If disabled, matching records will be skipped.' string='Override existing items'
  • record_ids One2many → import.record
    string='Records' args: 'import.record', 'recordset_id'
  • report_data Binary
    attachment=True
  • report_file Binary
  • report_filename Char
  • report_html Html
    compute='_compute_report_html' args: 'Report summary'
  • sequence Integer
    default=10 help='Sequence for the handle.'
  • server_action_ids Many2many → ir.actions.server
    help="Execute a server action when done. You can link a server action per model or a single one for import.recordset. In that case you'll have to use low level api to get the records that were processed. Eg: `get_report_by_model`." string='Executre server actions' args: 'ir.actions.server'
  • server_action_importable_model_ids Many2many → ir.model
    column1='recordset_id' column2='model_id' comodel_name='ir.model' compute='_compute_importable_model_ids' help='Technical field' relation='import_recordset_server_action_importable_model'
  • server_action_trigger_on Selection
    default='never' selection=[('never', 'Never'), ('last_importer_done', 'End of the whole import'), ('each_importer_done', 'End of each importer session')]
  • shared_data Binary
    attachment=True
Public methods (11)
  • available_importers(self)
  • debug_mode(self)
  • generate_report(self)
  • get_records(self)
    Retrieve importable records and keep ordering.
  • get_report(self)
  • get_report_by_model(self, model_name=None)
  • get_shared(self)
  • import_recordset(self)
    This job will import a recordset.
  • run_import(self)
    queue a job for creating records (import.record items)
  • set_report(self, values, reset=False)
    Update import report values.
  • set_shared(self, values, reset=False)
    Update import report values.

New fields (3)
  • chunk_size Integer
    default=500 required=True string='Chunks Size'
  • config_summary Html
    compute='_compute_config_summary'
  • name Char
    compute='_compute_name'
Public methods (4)
  • create(self, vals_list)
    @api.model_create_multi
  • get_config_view_id(self)
    Retrieve configuration view.
  • get_lines(self)
    Retrieve lines to import.
  • get_reporter(self)
    Retrieve a specific reporter for this source. A report can be used to produce and extensive report for the end user. See `reporter` models.

New fields (4)
  • source_config_summary Html
    compute='_compute_source_config_summary' readonly=True
  • source_id Integer
    required=False string='Source ID'
  • source_model Selection
    selection='_selection_source_ref_id' string='Source type'
  • source_ref_id Reference
    compute='_compute_source_ref_id' selection='_selection_source_ref_id' store=False string='Source'
Public methods (2)
  • get_source(self)
    Return the source to the consumer.
  • open_source_config(self)

New fields (10)
  • csv_delimiter Char
    default=';' string='CSV delimiter'
  • csv_encoding Char
    string='CSV Encoding'
  • csv_file Binary
    args: 'CSV file'
  • csv_filename Char
    args: 'CSV filename'
  • csv_filesize Char
    compute='_compute_csv_filesize' readonly=True string='CSV filesize'
  • csv_path Char
    args: 'CSV path'
  • csv_quotechar Char
    default='"' string='CSV quotechar'
  • csv_rows_from_to Char
    string='CSV use only a slice of the available lines. Format: $from:$to. NOTE: recommended only for debug/test purpose.'
  • example_file_ext_id Char
    help="You can define example file by creating attachments with an external ID matching the 'import.source.csv' record external ID:\n\t${import.source.csv.ExtID}_example_file\n\nYou can also specify your own external ID by filling this field."
  • example_file_url Char
    compute='_compute_example_file_url' string='Download example file'
Public methods (0)

No public methods.

New fields (5)
  • description Text
  • key Char
    copy=False help='Unique mnemonic identifier' required=True
  • name Char
    help='A meaningful human-friendly name' required=True
  • options Text
    help='YAML configuration'
  • use_job Boolean
    default=True help='For each importer used in the settings, one job will be spawned. Untick the box if an importer depends on the result of a previous one (for instance to link a record to the previously created one).'
Public methods (2)
  • available_importers(self)
  • copy_data(self, default=None)

New fields (2)
  • job_id Many2one → queue.job
    index=True readonly=True string='Job' args: 'queue.job'
  • job_state Selection
    index=True related='job_id.state'
Public methods (3)
  • has_job(self)
  • job_done(self)
  • unlink(self)

New fields (0)

No new fields.

Public methods (4)
  • report_add_line(self, writer, item)
  • report_do(self, recordset, fileout, **options)
    Produce report.
  • report_get_columns(self, recordset, orig_content, extra_keys=None, delimiter=';', quotechar='"')
    Retrieve columns by recordset. :param recordset: instance of recordset. :param orig_content: original csv content list of line. :param extra_keys: report-related extra columns.
  • report_get_writer(self, fileout, columns, delimiter=';', quotechar='"')

New fields (0)

No new fields.

Public methods (4)
  • report_do(self, recordset, fileout, **options)
    Override me to generate the report.
  • report_finalize(self, recordset, fileout, **options)
    Apply late updates to report.
  • report_get(self, recordset, **options)
    @api.model
    Create and return a report for given recordset.
  • report_get_metadata(self, recordset, **options)
    Retrieve report file's metadata.

Loading…

Loading…

Loading…

Loading…

Loading…

Loading…

Loading…

Loading…