Sunday, July 28, 2024
1 change · saas-17.2
Miscellaneous changes
Refs. commits message for steps to reproduce COMMIT 1: ---------------- Issue: ------ One attachment has been removed (not linked anymore to the move). Cause: ------ When switching the main attachment, the versioning is triggered; the new main attachment is set on the document and the previous is added to the history for versioning (and therefore also change the res fields to be linked to the document instead of the move). Solution: --------- When updating the attachm
Original PR description
Refs. commits message for steps to reproduce COMMIT 1: ---------------- Issue: ------ One attachment has been removed (not linked anymore to the move). Cause: ------ When switching the main…
Refs. commits message for steps to reproduce COMMIT 1: ---------------- Issue: ------ One attachment has been removed (not linked anymore to the move). Cause: ------ When switching the main attachment, the versioning is triggered; the new main attachment is set on the document and the previous is added to the history for versioning (and therefore also change the res fields to be linked to the document instead of the move). Solution: --------- When updating the attachment of a document that already have an attachment (normal versioning), we should remove the link between the current document attachment (not the new one) and the related model only if the related model has not a `message_main_attachment_id` field or if the current document attachment is different of the main attachment set on the related model. COMMIT 2: ---------------- Issue: ------ A second document is created. Cause: ------ The issue is when switching the second time the invoice main attachment, the current main attachment is in fact in the versioned attachments (`document.preview_attachment_ids`), and since we search only for document that have as attachment (`document.attachment_id`) the current invoice main attachment, we don't find it and create a new document. Solution: --------- Look also in the versioned attachments when searching for the invoice main attachment in case it has been versioned. opw-4028789 Forward-Port-Of: odoo/enterprise#67464 Forward-Port-Of: odoo/enterprise#66501