From 9c9b7d7c37c2da33eecd0ecc6a60e158c8d6213a Mon Sep 17 00:00:00 2001 From: Swapnesh Shah Date: Mon, 2 Aug 2021 20:33:50 +0000 Subject: [PATCH] [IMP] mrp: remove linked attachement on removing mrp document Steps to Reproduce Bug: - Add Attachment on Bom Line - Delete Attachment Bug: - Attachment is still present on `ir.attachment` With this commit, we are removing linked attachment on deleting `mrp.document` closes odoo/odoo#74595 Signed-off-by: Arnold Moyaux --- addons/mrp/models/mrp_document.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addons/mrp/models/mrp_document.py b/addons/mrp/models/mrp_document.py index 73009000acf..f49602d84ed 100644 --- a/addons/mrp/models/mrp_document.py +++ b/addons/mrp/models/mrp_document.py @@ -22,3 +22,7 @@ class MrpDocument(models.Model): ('1', 'Low'), ('2', 'High'), ('3', 'Very High')], string="Priority", help='Gives the sequence order when displaying a list of MRP documents.') + + def unlink(self): + self.mapped('ir_attachment_id').unlink() + return super(MrpDocument, self).unlink()