Saturday, July 19, 2025
2 changes · saas-18.4
Enhancements to existing features
Purchase orders linked to a project now keep the project cost allocation alongside existing manual or model-based allocations when they do not conflict. This improves cost tracking by ensuring project-related purchasing expenses are consistently assigned without overwriting other valid accounting distributions.
Original PR description
Currently, if a purchase order line has an analytic distribution and then a project with an analytic account is added to the PO, the project analytic distribution is not added. Only in lines without any analytic distribution, the projetc account is added as expected. This commit modifies `_compute_analytic_distribution()` to keep both the project account and the existing analytic distribution (that were added manually or from a distribution model) in all PO lines where the analytic plans do not conflict. task-4904044 --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#216814
Resolved issues and error corrections
Scheduled messages from the chatter now send when the user requested instead of being delayed until a later email queue run. This improves reliability for planned customer or internal communications that depend on precise timing.
Original PR description
**Steps to reproduce:** - Go to the chatter of any record - Click on `Send message` - Click on `Full composer` icon on the bottom right - Prepare an email with custom subject / body - Click on `Send…
**Steps to reproduce:**
- Go to the chatter of any record
- Click on `Send message`
- Click on `Full composer` icon on the bottom right
- Prepare an email with custom subject / body
- Click on `Send Later` and set the scheduled time
- Mail is not sent on scheduled time
**Issue:**
For the timing issue, as the mail is sent by a cron job it obtains a context with `mail_notify_force_send` set to `False` due to the function `_get_eval_context` of `ir.actions.server`.
```
""" Override the method giving the evaluation context but also the
context used in all subsequent calls. Add the mail_notify_force_send
key set to False in the context. This way all notification emails linked
to the currently executed action will be set in the queue instead of
sent directly. This will avoid possible break in transactions. """
```
This context override the `force_send` value used when sending emails notifications. Everything is created properly but the mail is not sent directly and goes to the email queue manager (where it needs to wait until the next execution). This means that the time given previously is not explicitly used to send the mail and the mail is delayed (which doesn't seem to be the expected behavior).
```
if force_send := self.env.context.get('mail_notify_force_send', force_send):
force_send_limit = int(self.env['ir.config_parameter'].sudo().get_param('mail.mail.force.send.limit', 100))
force_send = len(emails) < force_send_limit
if force_send and (not self.pool._init or test_mode):
# unless asked specifically, send emails after the transaction to
# avoid side effects due to emails being sent while the transaction fails
if not test_mode and send_after_commit:
emails.send_after_commit()
else:
emails.send()
```
**Fix:**
Overwrite `mail_notify_force_send` value when posting the scheduled message in the cron job.
related: https://github.com/odoo/odoo/commit/df18d5257cef737f3e1d245a8b85769e1fe1a032
opw-4700253
---
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
Forward-Port-Of: odoo/odoo#219475
Forward-Port-Of: odoo/odoo#211515