Force invoice status Odoo 18. Are you struggling with managing invoice status in Odoo 18 sale orders? Perhaps you’ve encountered situations where you need to force invoice status to fully invoiced, but don’t know how. In this comprehensive guide, I’ll walk you through how to force the invoice status of a sale order in Odoo 18, giving you more control over your invoicing workflow and ensuring your sale orders reflect the correct status.
Understanding Invoice Status in Odoo 18 Sale Orders
Before diving into how to force invoice status, let’s first understand what invoice status is and how it works in Odoo 18. The invoice status field in sale orders indicates whether the order has been fully invoiced, partially invoiced, or not invoiced at all.
Moreover, this status normally updates automatically based on the delivery and invoicing of products in the order. However, there are situations where you might need to manually force this status, especially when:
- You’ve delivered fewer products than initially ordered
- You’ve delivered more products than ordered
- You need to mark an order as fully invoiced for administrative purposes
Essentially, the invoice status field helps track the billing status of your orders, making it easier to manage your finances and customer relationships.
How Odoo 18 Handles Invoice Status Automatically
First, let’s examine how Odoo 18 naturally handles invoice status through a few examples. This will give us a better understanding of the default behavior before we attempt to override it.
Example 1: Fully Delivered and Invoiced Orders
When you create a sale order and deliver all products, Odoo automatically marks the order lines in blue, indicating they’re ready to be invoiced. Here’s what happens:
- Create a sale order (for example, 10 units of a product at €1 per unit)
- Deliver all 10 units
- Return to the sale order to see blue order lines
- Create an invoice for all 10 units
- Confirm the invoice
- Check the sale order – the status changes to “Fully Invoiced”
In this scenario, everything works smoothly because all ordered products are delivered and invoiced.
Example 2: Partially Delivered and Invoiced Orders
Now, let’s look at what happens when you deliver and invoice only part of an order:
- Create a sale order for 10 units
- Deliver only 5 units
- Create a back order for the remaining 5 units
- Invoice the 5 delivered units
- Check the sale order – the status shows “Nothing to Invoice”
The status “Nothing to Invoice” means there’s nothing to invoice at the moment, but it doesn’t mean the order is fully invoiced. If you later deliver the remaining 5 units, you’ll be able to invoice them too.
Example 3: When You Don’t Deliver Everything
What if you can’t deliver all the ordered products? For example:
- Create a sale order for 10 units
- Deliver only 5 units
- Don’t create a back order (perhaps you can’t fulfill the rest of the order)
- Invoice the 5 delivered units
- Check the sale order – it shows “Nothing to Invoice”
But here’s the problem: the order will forever show “Nothing to Invoice” even though you won’t be delivering or invoicing the remaining 5 units. This is where you might want to force the status to “Fully Invoiced” to indicate the order is complete.
Three Ways to Force Invoice Status in Odoo 18
Now that we understand the problem, let’s look at three methods to force invoice status in Odoo 18:
Method 1: Modify the Order Quantity
The simplest approach is to modify the ordered quantity to match what you’ve actually delivered:
- Go to the sale order
- Edit the order line
- Change the quantity from the original amount to the delivered amount
- Save the changes
For instance, if you originally ordered 10 units but only delivered 5, change the order quantity to 5. When you save, the invoice status will automatically update to “Fully Invoiced.”
This method is straightforward but has a drawback: it alters the original order, which might not be desirable for record-keeping purposes.
Method 2: Create a Zero-Value Invoice
Another approach is to create an additional invoice with zero value for the undelivered items:
- Create a new invoice for the remaining quantity
- Set the unit price to zero
- Confirm the invoice
For example, if you delivered 10 units but invoiced 11 (due to a mistake), you can:
- Create a new invoice for 1 unit
- Set the unit price to €0
- Confirm the invoice
This method preserves the original order quantities but adds an extra invoice, which might complicate your records.
Method 3: Use a Server Action (Best Method)
The most elegant solution is to create a server action that directly modifies the invoice status field:
- Activate developer mode in Odoo
- Go to Technical > Server Actions
- Create a new server action with the following details:
- Model: Sale Order
- Action To Do: Python Code
- Python Code to execute (see below)
- Make it available as a contextual action
for record in records:
record.invoice_status = 'invoiced'
This code directly sets the invoice_status field to ‘invoiced’, which corresponds to “Fully Invoiced”.
- Name the action “Force Fully Invoiced”
- Save the server action
- Refresh your browser to clear the cache
- Now you can select any sale order and use the “Force Fully Invoiced” option from the Action menu
This method is the most professional approach because:
- It doesn’t alter the original order quantities
- It doesn’t create unnecessary invoices
- It clearly indicates that the status was manually forced
- It’s available as an action that administrators can use when needed
Step-by-Step Guide to Creating the Server Action
Let’s go through the detailed steps to implement the server action method:
Step 1: Enable Developer Mode
First, you need to enable developer mode in Odoo 18:
- Click on your profile picture in the top-right corner
- Select “Settings”
- Scroll down to “Developer Tools”
- Click “Activate the developer mode”
- The page will reload with developer mode enabled
Alternatively, you can use a browser extension or add “/web?debug=1” to your Odoo URL.
Step 2: Access Server Actions
With developer mode enabled:
- Go to the main menu
- Find the “Technical” menu (only visible in developer mode)
- Navigate to Technical > Server Actions
Step 3: Create a New Server Action
Now, create the server action:
- Click “Create” to make a new server action
- Fill in the following details:
- Action Name: Force Fully Invoiced
- Model: Sale Order (search and select it)
- Action To Do: Python Code
- Groups: Administrators (or any other group that should have access)
- Python Code:
for record in records: record.invoice_status = 'invoiced' - Check “Action” under “Binding Model” to make it available as a contextual action
- Save the server action
Step 4: Clear Cache and Test
After creating the server action:
- Refresh your browser (Ctrl+F5 or Cmd+Shift+R) to clear the cache
- Go to any sale order that has “Nothing to Invoice” status
- Click on the “Action” menu
- You should see “Force Fully Invoiced” in the dropdown
- Select it, and the status should change to “Fully Invoiced”
Common Use Cases for Forcing Invoice Status
Let’s explore some real-world scenarios where forcing invoice status is particularly useful:
Partial Deliveries with No Future Shipments
When you can only partially fulfill an order and won’t be delivering the remaining items, forcing the invoice status helps you:
- Mark the order as complete in your system
- Prevent it from appearing in “To Invoice” reports
- Provide clearer financial reporting
Correcting Delivery Mistakes
If you accidentally delivered more products than ordered:
- Invoice the correct quantity
- Force the invoice status to “Fully Invoiced”
This avoids creating unnecessary correction invoices with zero values.
Administrative Clean-up
For old orders with discrepancies between ordered and delivered quantities, you can use the force invoice status feature to clean up your system without modifying historical data.
Best Practices for Managing Invoice Status in Odoo 18
To maintain clean and accurate records while using forced invoice status:
Document Your Actions
Whenever you force an invoice status, add a note in the chatter:
- After forcing the status, click on the message icon in the sale order
- Write a note explaining why you forced the status
- This creates an audit trail for future reference
Create a Specific User Group
Instead of giving all administrators access to force invoice status:
- Go to Settings > Users & Companies > Groups
- Create a new group called “Invoice Status Managers”
- Update your server action to only be available to this group
- Assign only specific users to this group
This ensures better control over who can modify invoice statuses.
Regular Auditing
Set up a regular review process:
- Create a custom report to list all orders with forced invoice status
- Review this report monthly to ensure proper use
- Check for patterns that might indicate underlying process issues
Extending the Functionality
Want to take it a step further? Here are some ways to extend the invoice status functionality:
Add a Visual Indicator
Create a custom field to show when invoice status has been forced:
- Go to Technical > Database Structure > Models
- Find the “sale.order” model
- Add a new Boolean field called “forced_invoice_status”
- Update your server action code:
for record in records:
record.invoice_status = 'invoiced'
record.forced_invoice_status = True
- Add this field to your sale order views with a visual indicator
Create Multiple Status Options
Instead of just forcing “Fully Invoiced”, create additional options:
- Create multiple server actions:
- Force No Invoice Needed
- Force Fully Invoiced
- Reset to Automatic Status
Each with the appropriate code to set the invoice_status field.
Automated Reporting
Set up automated emails for management:
- Create a scheduled action to run daily
- Have it check for orders where invoice status was forced that day
- Send a summary email to the accounting team
Troubleshooting Common Issues
Server Action Not Appearing
If your “Force Fully Invoiced” option doesn’t appear in the Action menu:
- Verify you refreshed the cache (Ctrl+F5)
- Check that you marked the action as a contextual action
- Ensure you’re in the correct view (form view, not list view)
- Verify you have the proper permissions
Status Reverts After Changes
If the status reverts to “Nothing to Invoice” after you force it:
- Check if there are any automated workflows modifying the status
- Look for custom modules that might be overriding the field
- Consider adding a field lock in your server action:
for record in records:
record.invoice_status = 'invoiced'
record.write({'invoice_status_locked': True}) # Custom field you'd need to create
Field Not Editable Error
If you encounter errors when running the server action:
- Check your Odoo logs for specific error messages
- Verify the field name hasn’t changed in your version of Odoo
- Ensure you have proper permissions on the model
Comparing With Other ERP Systems
How does Odoo’s invoice status handling compare to other ERP systems? Let’s look at a few:
SAP Business One
SAP Business One handles partial deliveries differently:
- Automatically creates back orders
- Allows manual closing of orders
- Provides more granular status tracking
However, it’s generally more complex to customize than Odoo.
NetSuite
NetSuite offers:
- Built-in status forcing through “Close Order” functionality
- More detailed order status tracking
- Complex permission systems for status modifications
While more powerful, NetSuite typically requires more training and has a higher cost.
Microsoft Dynamics 365
Dynamics 365:
- Uses concept of “Order Completion” rather than invoice status
- Provides workflow automation for status changes
- Requires more development for custom status handling
For more information on ERP comparisons, check out this ERP comparison guide.
Conclusion
Forcing invoice status in Odoo 18 gives you more control over your sales process and ensures your system accurately reflects the reality of your business operations. While Odoo provides automatic invoice status tracking, the ability to override it when necessary is crucial for dealing with real-world scenarios.
The server action method we’ve explored offers a clean, professional way to force invoice status without altering original order data or creating unnecessary invoices. By implementing this solution, you can:
- Keep your sales records accurate
- Improve financial reporting
- Remove orders from invoice-related views when appropriate
- Streamline your order processing workflow
Remember to document your actions, limit access to this feature, and regularly review its usage to maintain system integrity.
Have you implemented custom invoice status handling in your Odoo system? What challenges have you faced? Share your experiences in the comments below!
FAQs About Forcing Invoice Status in Odoo 18
Can I undo a forced invoice status?
Yes, you can create another server action that sets the invoice_status back to its calculated value. The code would be more complex as you’d need to recalculate the status based on deliveries and invoices.
Will forcing invoice status affect accounting entries?
No, forcing invoice status only changes the status field in the sale order. It doesn’t create or modify any accounting entries or invoices.
Can I force invoice status in bulk for multiple orders?
Yes, you can select multiple orders in the list view and use the server action on all of them at once.
Is this method compatible with Odoo Enterprise and Community editions?
Yes, this method works in both Odoo Enterprise and Community editions, as it uses core functionality.
Will custom modules affecting invoicing interfere with forced invoice status?
Possibly. Some custom modules might override the invoice status field calculation. You should test the solution with your specific modules.
Do I need technical skills to implement this solution?
Basic understanding of Odoo administration and simple Python is helpful. However, by following this guide step-by-step, even non-technical users can implement the solution.
Discover more from teguhteja.id
Subscribe to get the latest posts sent to your email.

