aktr-odoo 0a44cd32cf [FIX] account: ensure attachment existence in mail attachments
The traceback arises when a user deletes an attachment that the referenced in
the `account.move.send` model's `mail_attachments_widget` field, and
subsequently, the cron uses `mail_attachments_widget` to send invoices.

Steps to produce:
- Install account.
- Open Invoicing > open any invoice > click on SEND & PRINT > click on SAVE.
- Add an attachment > refresh the page.
- Go to attachments > delete the attachment which you have uploaded.
- Let the cron `Send invoices automatically ` run automatically.

ERROR: Traceback will appear MissingError Record does not exist or has been
deleted.

A `mail_attachments_widget` is a `JSON`storable field (Line 1) of the
`account.move.send` model. `mail_attachments_widget` carries data like the
attachment's ID, name, and mime type. Cron utilized the
`mail_attachments_widget` field to retrieve attachment data when sending an
email with attachments. `seen_attachment_ids` is a list of IDs (Line 2) of
attachments prepared using `mail_attachments_widget`.

This commit fetches only existing attachment records from the 'ir.attachment'
model for the attachment IDs present in the `seen_attachment_ids` list.

Line [1]- https://github.com/odoo/odoo/blob/0c95e064ca6384f57154bb12d3b4ef55ee1b4da3/addons/account/wizard/account_move_send.py#L76-L80
Line [2]- https://github.com/odoo/odoo/blob/d87dc624c33c8edd0eafc130b02a95fd91e58094/addons/account/wizard/account_move_send.py#L433-L439

Sentry-4315708399

closes odoo/odoo#133951

X-original-commit: 2486300538bc68075cba530bec481909af1aeb0d
Signed-off-by: William André (wan) <wan@odoo.com>
2023-09-01 15:09:59 +00:00
2023-09-01 15:09:51 +00:00
2023-09-01 13:21:00 +00:00
…
…
…
…
…

Build Status Tech Doc Help Nightly Builds

Odoo

Odoo is a suite of web based open source business apps.

The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, ...

Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.

Getting started with Odoo

For a standard installation please follow the Setup instructions from the documentation.

To learn the software, we recommend the Odoo eLearning, or Scale-up, the business game. Developers can start with the developer tutorials

S
Description
No description provided
Readme LGPL-3.0
3.4 GiB
Languages
Python 49.6%
JavaScript 47.8%
SCSS 2%
CSS 0.3%
HTML 0.2%