[IMP] project_mrp: add help message when no record in MRP action

Before this commit, when the user clicks on "Manufactoring" row in
Project Profitability section displayed in right side panel the user
arrives in the tree view if there are more than one record. If he
filters the records and found no record then no help message is shown,
he has just an empty list view.

This commit adds a help message for that action to dislplay it when no
record is shown in the list view (or another view) for this action.

task-2814466

Part-of: odoo/odoo#88219
This commit is contained in:
Xavier BOL (xbo)
2022-04-08 17:13:30 +02:00
parent 5dd5149df1
commit 3c5de9490a
+12 -3
View File
@@ -14,9 +14,18 @@ class Project(models.Model):
def action_view_mrp_production(self):
self.ensure_one()
action = self.analytic_account_id.action_view_mrp_production()
if self.production_count > 1:
action["view_mode"] = 'tree,form,kanban,calendar,pivot,graph'
action = self.env['ir.actions.actions']._for_xml_id('mrp.mrp_production_action')
action['domain'] = [('analytic_account_id', '=', self.analytic_account_id.id)]
action['context'] = {'default_analytic_account_id': self.analytic_account_id.id}
if self.production_count == 1:
action['view_mode'] = 'form'
action['res_id'] = self.analytic_account_id.production_ids.id
if 'views' in action:
action['views'] = [
(view_id, view_type)
for view_id, view_type in action['views']
if view_type == 'form'
] or [False, 'form']
return action
def action_view_mrp_bom(self):