Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Property Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
      • Get a Tailored Demo
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +32 2 290 34 90
    • Get a Tailored Demo
  • Pricing
  • Help
  1. APPS
  2. Specific Industry Applications
  3. Import Step: Sale v 17.0
  4. Sales Conditions FAQ

Import Step: Sale

by Futural https://github.com/tawasta/server-tools
Odoo
v 17.0 Third Party
Download for v 17.0 Deploy on Odoo.sh
Apps purchases are linked to your Odoo account, please sign in or sign up first.
Availability
Odoo Online
Odoo.sh
On Premise
Odoo Apps Dependencies • Contacts (contacts)
• Discuss (mail)
• Invoicing (account)
Community Apps Dependencies Show
• Import Core
• Import Step: Contacts
• Import Step: Products
Lines of code 747
Technical Name import_step_sale
LicenseAGPL-3
Websitehttps://github.com/tawasta/server-tools
You bought this module and need support? Click here!

Import Step: Sales

Adds a Sales Orders + Lines import step for the import_core framework.

This module registers:

  • Import step: sale
  • Runner model: generic.import.runner.sale

The step integrates with the generic dispatcher provided by import_core.

Features

The sales import step supports:

  • Creating sales orders
  • Reusing existing sales orders via search fields
  • Creating sales order lines
  • Reusing existing sales order lines via search fields
  • Shared import state integration
  • Automatic order-line linking
  • Integration with imported contacts and products
  • Sequential import chaining

The module depends on:

  • import_core
  • sale
  • import_step_contacts
  • import_step_products

Import step registration

The module registers the following import step:

<record id="generic_import_step_sale" model="generic.import.step">
    <field name="name">Sales Orders + Lines</field>
    <field name="code">sale</field>
    <field name="sequence">40</field>
    <field name="required_models">
        sale.order,sale.order.line
    </field>
</record>

This means:

  • The dispatcher executes runner:

    generic.import.runner.sale

  • The step is only available when models:

    • sale.order
    • sale.order.line

    are installed.

Configuration

  1. Install modules:

    • import_core
    • sale
    • import_step_contacts
    • import_step_products
    • import_step_sale
  2. Open:

    Imports -> Templates

  3. Create or edit a template

  4. Add import step:

    • Sales Orders + Lines
  5. Configure field mappings for models:

    • sale.order
    • sale.order.line
  6. Optionally mark fields as:

    • Is search field

Search fields are used to find existing records before creating new ones.

Usage

Sales order import

Map CSV/XLSX columns to sale.order fields.

Example mappings:

  • Order Reference -> sale.order.client_order_ref
  • Order Date -> sale.order.date_order

Import behavior:

  • Existing sales orders are reused when search fields match
  • New sales orders are created when no match exists

Example CSV

Customer,Product,Quantity
Example Customer,Test Product,2

Sales order line import

Map CSV/XLSX columns to sale.order.line fields.

Example mappings:

  • Quantity -> sale.order.line.product_uom_qty
  • Price -> sale.order.line.price_unit

Import behavior:

  • Existing sales order lines are reused when search fields match
  • New sales order lines are created when no match exists

Automatic linking

The runner automatically stores created records into shared state.

Sales order:

state = self._set_state_record(
    state,
    "sale_order",
    sale_order,
)

Sales order line:

state = self._set_state_record(
    state,
    "sale_order_line",
    sale_order_line,
)

This allows state links to assign relations automatically.

Typical state link examples:

Partner to sales order

source_state_key = partner
target_model     = sale.order
target_field     = partner_id

Product to sales order line

source_state_key = product
target_model     = sale.order.line
target_field     = product_id

Sales order to sales order line

source_state_key = sale_order
target_model     = sale.order.line
target_field     = order_id

Shared import state

The step integrates with previous import steps.

Typical import chain:

  1. Contact step imports partner
  2. Product step imports product
  3. Sale step imports order and lines

The step commonly consumes:

  • state["partner"]
  • state["product"]

The step stores:

  • state["sale_order"]
  • state["sale_order_line"]

Automatic model-based state keys are also generated by generic.import.runner.base.

Example:

state["sale_order"]
state["sale_order_line"]
state["sale_order_line"]

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:

  1. Read mapped sales order values
  2. Search/create sale.order
  3. Store order into shared state
  4. Read mapped sales line values
  5. Search/create sale.order.line
  6. Store line into shared state
  7. Apply configured state links

Search field behavior

Fields marked as Is search field are used to build lookup domains.

Example:

  • client_order_ref marked as search field

The runner performs:

self.env["sale.order"].search([
    ("client_order_ref", "=", value)
], limit=1)

If a matching record is found:

  • Existing record is reused
  • Duplicate creation is avoided

Dependencies

Python dependencies:

  • None

Odoo dependencies:

  • import_core
  • sale
  • import_step_contacts
  • import_step_products

Known issues / Roadmap

Credits

Contributors

  • Valtteri Lattu <valtteri.lattu@tawasta.fi>

Maintainer

Oy Tawasta OS Technologies Ltd.

This module is maintained by Oy Tawasta OS Technologies Ltd.

Please log in to comment on this module

  • The author can leave a single reply to each comment.
  • This section is meant to ask simple questions or leave a rating. Every report of a problem experienced while using the module should be addressed to the author directly (refer to the following point).
  • If you want to start a discussion with the author, please use the developer contact information. They can usually be found in the description.
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with