Copy Chatter from Sale Order to Delivery Order in Odoo18
In any business workflow, communication is everything. Whether it's internal coordination between teams or external interaction with customers, having the right information at the right time can make all the difference.
In Odoo 18, the copy chatter from Sale Order feature serves as a centralized communication hub. It keeps track of messages, emails, log notes, system notifications, and activities related to a specific document. While this functionality is powerful, it comes with a limitation chatter messages created in a Sale Order are not automatically transferred to the corresponding Delivery Order.
This gap can create confusion, especially for warehouse teams who rely on delivery orders to fulfill shipments accurately. Missing context can lead to delays, errors, or unnecessary back-and-forth communication.
In this blog, we’ll walk you through two practical approaches to solve this issue:
- Copying the entire chatter history
- Copying only internal log notes
By the end, you’ll be able to choose the approach that best fits your business workflow.
Understanding Copy Chatter from Sale Order in Odoo
Before getting into the solution, let’s briefly understand what chatter includes in Odoo.
Chatter is more than just a messaging tool, it acts as a timeline of all activities related to a record. It includes:
- Log Notes (Internal Notes):
These are used for internal communication within teams. They are not visible to customers and often include operational instructions or updates. - Emails:
These represent communication sent to or received from customers directly from the document. - System Notifications:
Automatically generated updates such as status changes, order confirmations, or automated alerts. - Activities:
Tasks, reminders, and follow-ups assigned to users.
While all this information is useful in a Sale Order, not all of it is always relevant for a Delivery Order. That’s why choosing the right approach for copying chatter becomes important.
Case 1: Copy Entire Chatter
In the first approach, we copy all chatter messages from the Sale Order to the Delivery Order without any filtering.
When should you use this?
This method is ideal when:
- You want complete transparency
- Your delivery team needs full context, including customer communication
You prefer not to miss any detail, even if it includes extra information
Python Implementation (sale_order.py)
from odoo import models, fields, api
class SaleOrder(models.Model):
_inherit = 'sale.order'
def action_chatter_copy(self):
"""
Copies Chatter messages from the sale order to the first
non-cancelled delivery order.
"""
messages_sale = self.env["mail.message"].search(
["&", ("res_id", "=", self.id),
("model", "=", "sale.order")], order='create_date asc')
for chat in messages_sale:
delivery_id = [x.id for x in
self.picking_ids.filtered(
lambda l: l.state != 'cancel')]
chat.copy({"model": "stock.picking", "res_id": delivery_id[0]})
How It Works
This method follows a straightforward logic:
- It fetches all messages from the message model linked to the Sale Order
- No filters are applied, so it includes:
- Emails
- Log notes
- System-generated messages
- It then identifies the first valid Delivery Order (excluding cancelled ones)
- Finally, it copies each message to the Delivery Order
Pros and Cons
Advantages:
- Complete communication history is preserved
- No risk of missing important messages
- Useful for audit trails and customer-related queries
Limitations:
- Can clutter the Delivery Order with unnecessary information
- Includes external emails that may not be relevant for warehouse operations
Sale Order Chatter
2️⃣ Copy Chatter Button
3️⃣ Delivery Before Copy
4️⃣ Delivery After Copy
Case 2: Copy Only Log Notes
The second approach focuses only on internal communication, ensuring that the Delivery Order remains clean and relevant.
When should you use this?
This approach is best when:
- You want only actionable internal notes
- Your warehouse team does not need customer emails
- You prefer a clean and focused chat view
def action_chatter_copy(self):
"""
Copies only Log Notes (internal notes) from Sale Order
to the first non-cancelled Delivery Order.
"""
messages_sale = self.env["mail.message"].search([
("res_id", "=", self.id),
("model", "=", "sale.order"),
("message_type", "=", "comment") # ✅ Only Log Notes
], order='create_date asc')
delivery = self.picking_ids.filtered(lambda l: l.state != 'cancel')[:1]
if not delivery:
return
for chat in messages_sale:
chat.copy({
"model": "stock.picking",
"res_id": delivery.id
})
📝 Explanation
This approach is similar to the first one but introduces one key difference:
- It filters messages using:
message_type = 'comment'
This ensures that only Log Notes (internal notes) are selected. As a result:
- Emails are excluded
- System notifications are ignored
- Only relevant internal communication is transferred
Pros and Cons
Advantages:
- Keeps the Delivery Order clean and clutter-free
- Ensures only relevant information is shared
- Improves efficiency for warehouse teams
Limitations:
- Customer communication is not included
- Some context might be lost if notes are not detailed
Adding a “Copy Chatter” Button in a Sale Order
To make this functionality user-friendly, you can add a button directly in the Sale Order form view.
XML Code
sale_order.xml
sale.order.form.inherit.copy.chatter.sale
sale.order
Why This Matters
Adding a button simplifies the process by allowing users to copy chatter with a single click. This reduces dependency on technical users and ensures that the feature is easily accessible during daily operations.
Screenshots that show only log notes
The log chatter note is transferred to the corresponding delivery order when the "Copy Chatter" button is clicked
Best Practices for Implementation
To get the most out of this feature, consider the following:
- Choose the right approach based on your workflow
Not every business needs full chatter visibility - Train your team to use Log Notes effectively
Clear internal notes improve communication - Avoid unnecessary duplication
Too much information can be as harmful as too little - Test before deployment
Ensure the feature works correctly across different scenarios
Copy Chatter from Sale Order
Efficient communication between Sales and Warehouse teams is critical for smooth operations. While Odoo 18 provides a robust chatter system, the lack of automatic message transfer between Sales Orders and Delivery Orders can create gaps.
By implementing chatter copying, you can bridge this gap effectively:
- Copy the entire Chatter for full transparency and complete history
- Copy Only Log Notes for clean, focused internal communication
Both approaches have their own advantages, and the right choice depends on your business needs.
Ultimately, this small customization can lead to better collaboration, fewer errors, and improved operational efficiency, making your Odoo system even more powerful.