OdooWiki OCA HUB

Sale Order Action Invoice Create Hook

sale_order_action_invoice_create_hook folder_open OCA/sale-workflow open_in_new
Sale Workflow License: LGPL-3

This module adds hook points in sale_order.action_invoice_create() in order to add more flexibility in the grouping parameters for the creation of invoices and to give the possibility to take into account draft invoices.

Although the original code has been modified a bit, the logic has been respected and the method still does exactly the same.

auto_awesome What this module does

AI-generated from the code · Odoo 12.0

This module changes how invoices are created from sales orders, allowing invoices to be grouped by customer and currency instead of by sales order, and it adds hooks for developers to customize the grouping and include draft invoices.

When you create invoices from sales orders, Odoo normally groups invoice lines by sales order. This module changes that: it groups lines by the customer's invoice address and currency, so lines from different sales orders for the same customer and currency can end up on the same invoice.

It also adds several hook points that developers can use to customize the behavior without modifying the core code. For example, you can change the grouping key, decide which draft invoices to consider, or modify the invoices after they are created.

The module keeps the original logic for creating invoice lines, handling sections and notes, and managing refunds. It also posts a message on the invoice linking it to the originating sales orders.

This affects the sale.order and sale.order.line models. No new menus or screens are added; the change is visible when you use the standard 'Create Invoice' button on a sales order.

Depends on

sale
Models and fields (2)
  • sale.order · extends an existing model
  • sale.order.line · extends an existing model

Text generated by AI (DeepSeek) from reading the Odoo 12.0 code on GitHub; it may contain mistakes, so check the code before deciding. View the code on GitHub

Availability by version

Reviewed: 2026-11-03
Confirmed (verified in repository and branch) Estimated (unverified) No information

Confirmation status: 1 confirmed, 8 with no information of 9 versions.

Sources · Odoo 12.0

Confirmed on 2026-11-03 in branch 12.0 of OCA/sale-workflow.

terminal Installation and usage

OCA documentation · Odoo 12.0
  • Add dependency of this module
  • Inherit from 'sale.order'
  • Change the _get_invoice_group_key function in order to return more grouping fields to take into account when creating a single invoice from various Sales Orders.
  • Change the _get_draft_invoices function in order to take into account existing draft invoices when creating new ones. This feature is already implemented in the module sale_merge_draft_invoice.

No verified information in OCA: Installation, Configuration.

info

Data imported from GitHub: this sheet reflects the latest catalog review, not a live lookup. Always check the module documentation and staging before installing in production.