| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
Discuss (mail)
|
| Community Apps Dependencies | Show |
| Lines of code | 646 |
| Technical Name |
import_step_products |
| License | AGPL-3 |
| Website | https://github.com/tawasta/server-tools |
Import Step: Products
Adds a Products import step for the import_core framework.
This module registers:
- Import step: product
- Runner model: generic.import.runner.product
The step integrates with the generic dispatcher provided by import_core.
Features
The product import step supports:
- Creating products
- Reusing existing products via search fields
- Shared import state integration
- Automatic product variant handling
- Sequential import chaining
- Product reuse in later import steps
The module depends on:
- import_core
- product
Import step registration
The module registers the following import step:
<record id="generic_import_step_product" model="generic.import.step"> <field name="name">Products</field> <field name="code">product</field> <field name="sequence">30</field> <field name="required_models">product.template</field> </record>
This means:
The dispatcher executes runner:
generic.import.runner.product
The step is only available when model:
- product.template
is installed.
Configuration
Install modules:
- import_core
- product
- import_step_products
Open:
Imports -> Templates
Create or edit a template
Add import step:
- Products
Configure field mappings for model:
- product.template
Optionally mark fields as:
- Is search field
Search fields are used to find existing products before creating new ones.
Usage
Basic product import
Map CSV/XLSX columns to product.template fields.
Example mappings:
- Product Name -> product.template.name
- Internal Reference -> product.template.default_code
- Sales Price -> product.template.list_price
Import behavior:
- Existing products are reused when search fields match
- New products are created when no match exists
Example CSV
Product Name,Internal Reference,Sales Price Test Product,SKU-001,99.90
Search field behavior
Fields marked as Is search field are used to build lookup domains.
Example:
- default_code marked as search field
The runner performs:
self.env["product.template"].search([ ("default_code", "=", value) ], limit=1)
If a matching product is found:
- Existing record is reused
- Duplicate creation is avoided
Using products in later steps
Later import steps may reuse imported products through state links.
Typical use cases:
- Sale order lines
- Subscription lines
- Event registrations
- Custom business flows
Example state link configuration:
source_state_key = product target_model = sale.order.line target_field = product_id
Technical implementation
The runner inherits:
_inherit = "generic.import.runner.base"
Available helper methods include:
- _get_or_create()
- _get_or_create_from_lines()
- _build_domain()
- _clean_vals()
- _set_state_record()
Import flow
Simplified processing order:
- Read mapped product values
- Search/create product.template
- Store template into shared state
- Resolve product_variant_id
- Store variant into shared state
- Continue to next import step
Single variant behavior
The module currently assumes standard single-variant product usage.
The state key:
- state["product"]
always points to:
product_template.product_variant_id
This simplifies integration with later import steps expecting product.product records.
Dependencies
Python dependencies:
- None
Odoo dependencies:
- import_core
- product
Known issues / Roadmap
Credits
Contributors
- Valtteri Lattu <valtteri.lattu@tawasta.fi>
Maintainer
This module is maintained by Oy Tawasta OS Technologies Ltd.
Please log in to comment on this module