diff --git a/mrp_attachment_mgmt/__manifest__.py b/mrp_attachment_mgmt/__manifest__.py index 45791accf..662975cf6 100644 --- a/mrp_attachment_mgmt/__manifest__.py +++ b/mrp_attachment_mgmt/__manifest__.py @@ -11,6 +11,7 @@ "installable": True, "data": [ "views/mrp_bom_view.xml", + "views/mrp_production_views.xml", "views/product_views.xml", "views/workorder_attachments_views.xml", ], diff --git a/mrp_attachment_mgmt/models/__init__.py b/mrp_attachment_mgmt/models/__init__.py index cf484cc1a..1542b7b49 100644 --- a/mrp_attachment_mgmt/models/__init__.py +++ b/mrp_attachment_mgmt/models/__init__.py @@ -1,3 +1,4 @@ from . import mrp_bom +from . import mrp_production from . import mrp_workorder from . import product diff --git a/mrp_attachment_mgmt/models/mrp_production.py b/mrp_attachment_mgmt/models/mrp_production.py new file mode 100644 index 000000000..8410a213b --- /dev/null +++ b/mrp_attachment_mgmt/models/mrp_production.py @@ -0,0 +1,10 @@ +# Copyright 2023 Tecnativa - Pedro M. Baeza +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +from odoo import models + + +class MrpProduction(models.Model): + _inherit = "mrp.production" + + def action_show_attachments(self): + return self.product_id._action_show_attachments() diff --git a/mrp_attachment_mgmt/tests/test_mrp_attachment_mgmt.py b/mrp_attachment_mgmt/tests/test_mrp_attachment_mgmt.py index 354518f6d..799578bb5 100644 --- a/mrp_attachment_mgmt/tests/test_mrp_attachment_mgmt.py +++ b/mrp_attachment_mgmt/tests/test_mrp_attachment_mgmt.py @@ -33,3 +33,8 @@ class TestMrpAttachmentMgmt(TestMrpAttachmentMgmtBase): attachment = self._create_attachment(self.product) action = self.workorder.action_see_workorder_attachments() self.assertIn(attachment.id, self.attachment_model.search(action["domain"]).ids) + + def test_mrp_production_attachments(self): + attachment = self._create_attachment(self.product) + action = self.mrp_production.action_show_attachments() + self.assertIn(attachment.id, self.attachment_model.search(action["domain"]).ids) diff --git a/mrp_attachment_mgmt/views/mrp_production_views.xml b/mrp_attachment_mgmt/views/mrp_production_views.xml new file mode 100644 index 000000000..808845724 --- /dev/null +++ b/mrp_attachment_mgmt/views/mrp_production_views.xml @@ -0,0 +1,30 @@ + + + + mrp.production.form - Add attachments smart-button + mrp.production + + + +