[FIX] project_mrp: display MO button even if only confirmed or draft MO

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) <otd@odoo.com>
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
This commit is contained in:
Touati Djamel (otd)
2023-06-19 19:16:58 +02:00
parent faeeea76e9
commit 640332df35
@@ -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