module: base_import_match
version: 18.0
Steps to reproduce
- Install/configure
base_import_match on Odoo 18.0.
- Configure an Import Match rule for
product.template, for example using barcode or default_code as the matching field.
- Import products through the standard import wizard.
- Include normal product fields plus one2many supplier fields, for example:
name
barcode or default_code
seller_ids/name
seller_ids/product_code
seller_ids/price
seller_ids/discount
seller_ids/currency_id
- Run the import.
A minimal example is a product.template import where the match rule identifies existing products and the same file also imports supplierinfo lines through seller_ids/... fields.
Current behavior
The import crashes with a server error:
IndexError: list index out of range
Traceback excerpt:
File ".../addons/base_import/models/base_import.py", line 1466, in execute_import
import_result = model.load(import_fields, merged_data)
File ".../base_import_match/models/base.py", line 40, in load
for dbid, xmlid, record, info in converted_data:
File ".../odoo/models.py", line 1604, in _convert_records
for stream_index, (record, extras) in enumerate(records):
File ".../odoo/models.py", line 1533, in _extract_records
record_span = list(itertools.chain([row], record_span))
File ".../odoo/models.py", line 1480, in only_o2m_values
return any(get_o2m_values(row)) and not any(get_nono2m_values(row))
IndexError: list index out of range
If the seller_ids/... columns are removed from the same import, the import succeeds. This suggests the issue is specifically the combination of base_import_match with one2many import fields.
Expected behavior
The import should work as a normal Odoo import does with one2many fields: match/update the parent product using the configured rule and still allow creating/updating the related supplierinfo lines.
Analysis
This looks very similar to the issue fixed in previous branches:
PR #363 explicitly mentions that the previous progress was lost on fast migrations without porting.
In current 18.0, base_import_match/models/base.py still appears to use the older logic:
if "id" not in fields:
fields.append("id")
import_fields.append(["id"])
clean_fields = [f[0] for f in import_fields]
With one2many fields like seller_ids/name, seller_ids/price, etc., this collapses the subfield paths to repeated seller_ids keys and can also desynchronize fields / data before Odoo core _extract_records() handles one2many rows.
Previous fixed branches handled this by iterating through info["rows"]["from"] to info["rows"]["to"] and only applying the match logic on the first row of a parent record, preserving the full field list for the final import.
Additional info
This was reproduced on Odoo 18.0 with a product import containing 11 rows.
Removing the supplier one2many columns makes the import pass, while keeping them triggers the traceback above.
Suggested fix direction
Port the one2many handling fix from the previous branches to 18.0, especially the part that:
- avoids reducing import fields to
f[0] for one2many paths;
- preserves the original field list for the final import;
- processes all rows in
info["rows"]["from"] to info["rows"]["to"];
- applies the match logic only on the first row of each parent record.
module: base_import_match
version: 18.0
Steps to reproduce
base_import_matchon Odoo 18.0.product.template, for example usingbarcodeordefault_codeas the matching field.namebarcodeordefault_codeseller_ids/nameseller_ids/product_codeseller_ids/priceseller_ids/discountseller_ids/currency_idA minimal example is a
product.templateimport where the match rule identifies existing products and the same file also imports supplierinfo lines throughseller_ids/...fields.Current behavior
The import crashes with a server error:
Traceback excerpt:
If the
seller_ids/...columns are removed from the same import, the import succeeds. This suggests the issue is specifically the combination ofbase_import_matchwith one2many import fields.Expected behavior
The import should work as a normal Odoo import does with one2many fields: match/update the parent product using the configured rule and still allow creating/updating the related supplierinfo lines.
Analysis
This looks very similar to the issue fixed in previous branches:
[13.0][FIX] base_import_match - fix importing one2many records)[14.0][FIX] base_import_match: importing related o2m records)[16.0] Fix base_import_match for one2many)PR #363 explicitly mentions that the previous progress was lost on fast migrations without porting.
In current 18.0,
base_import_match/models/base.pystill appears to use the older logic:With one2many fields like
seller_ids/name,seller_ids/price, etc., this collapses the subfield paths to repeatedseller_idskeys and can also desynchronizefields/databefore Odoo core_extract_records()handles one2many rows.Previous fixed branches handled this by iterating through
info["rows"]["from"]toinfo["rows"]["to"]and only applying the match logic on the first row of a parent record, preserving the full field list for the final import.Additional info
This was reproduced on Odoo 18.0 with a product import containing 11 rows.
Removing the supplier one2many columns makes the import pass, while keeping them triggers the traceback above.
Suggested fix direction
Port the one2many handling fix from the previous branches to 18.0, especially the part that:
f[0]for one2many paths;info["rows"]["from"]toinfo["rows"]["to"];