From 640332df35e5bc810ca8ad7743633ecc6ec625a1 Mon Sep 17 00:00:00 2001 From: "Touati Djamel (otd)" Date: Mon, 12 Jun 2023 14:57:19 +0000 Subject: [PATCH] [FIX] project_mrp: display MO button even if only confirmed or draft MO MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Steps to reproduce the bug: - Install project_mrp - Create a MO: - select any product - add an analytic account linked to a project, e.g: “field service” - save - Go to the “field service” project - click on “project Updates” Problem: The manufacturing order view button is not displayed, because we have no MO in the done status To display the button, we do a "read_group" on the "account.analytic.line" related to the "account.analytic" of the project in the "Mrp" category. https://github.com/odoo/odoo/blob/08112964f76816f11ef28d702ae49243f9cb5f91/addons/project_mrp/models/project.py#L42-L46 However, since the "account.analytic.line" records are created only when the manufacturing order (MO) is in the "done" status, no records are found, and so the button is not displayed. opw-3300251 closes odoo/odoo#125620 X-original-commit: ddf49f0416dd398672f5b97af73f2f3d58cdc16f Signed-off-by: Djamel Touati (otd) Signed-off-by: Xavier Bol (xbo) --- addons/project_mrp/models/project_project.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/addons/project_mrp/models/project_project.py b/addons/project_mrp/models/project_project.py index cf53dbfe70c..d31d32390a1 100644 --- a/addons/project_mrp/models/project_project.py +++ b/addons/project_mrp/models/project_project.py @@ -95,5 +95,14 @@ class Project(models.Model): 'action': 'action_view_mrp_bom', 'show': self.bom_count > 0, 'sequence': 35, + }, + { + 'icon': 'wrench', + 'text': _lt('Manufacturing Orders'), + 'number': self.production_count, + 'action_type': 'object', + 'action': 'action_view_mrp_production', + 'show': self.production_count > 0, + 'sequence': 46, }]) return buttons