From 80bf615bbbb4ee2bb4a55031ee46671141e4074c Mon Sep 17 00:00:00 2001 From: "Xavier BOL (xbo)" Date: Mon, 27 Dec 2021 10:01:22 +0100 Subject: [PATCH] [REM] project_*,{hr,sale}_timesheet: remove some stat buttons in project update This commit removes stat buttons displayed in the right side panel in project update kanban view to prepare the revamp of the content shown in that project update. Indeed, the content in the right side panel will show the information shown in those stat buttons but with more details. task-2710808 --- addons/hr_timesheet/models/project.py | 20 +------------------- addons/project/models/project.py | 11 ----------- addons/project_hr_expense/models/project.py | 20 +------------------- addons/project_mrp/models/project.py | 18 ------------------ addons/sale_timesheet/models/project.py | 20 +------------------- 5 files changed, 3 insertions(+), 86 deletions(-) diff --git a/addons/hr_timesheet/models/project.py b/addons/hr_timesheet/models/project.py index 65624d415fd..a794adbdc16 100644 --- a/addons/hr_timesheet/models/project.py +++ b/addons/hr_timesheet/models/project.py @@ -3,7 +3,7 @@ from collections import defaultdict -from odoo import models, fields, api, _, _lt +from odoo import models, fields, api, _ from odoo.exceptions import UserError, ValidationError, RedirectWarning @@ -244,24 +244,6 @@ class Project(models.Model): uom_to = self.env.company.timesheet_encode_uom_id return round(uom_from._compute_quantity(time, uom_to, raise_if_failure=False), 2) - # ---------------------------- - # Project Updates - # ---------------------------- - - def _get_stat_buttons(self): - buttons = super(Project, self)._get_stat_buttons() - if self.user_has_groups('hr_timesheet.group_hr_timesheet_user'): - buttons.append({ - 'icon': 'clock-o', - 'text': _lt('Recorded'), - 'number': '%s %s' % (self.total_timesheet_time, self.env.company.timesheet_encode_uom_id.name), - 'action_type': 'object', - 'action': 'action_show_timesheets_by_employee_invoice_type', - 'show': self.allow_timesheets, - 'sequence': 6, - }) - return buttons - class Task(models.Model): _name = "project.task" diff --git a/addons/project/models/project.py b/addons/project/models/project.py index f1b5e2c9645..d276bdfa89a 100644 --- a/addons/project/models/project.py +++ b/addons/project/models/project.py @@ -10,7 +10,6 @@ from random import randint from odoo import api, Command, fields, models, tools, SUPERUSER_ID, _, _lt from odoo.exceptions import UserError, ValidationError, AccessError -from odoo.tools import format_amount from odoo.osv.expression import OR, AND from odoo.tools.misc import get_lang @@ -788,16 +787,6 @@ class Project(models.Model): 'show': True, 'sequence': 66, }) - if self.user_has_groups('analytic.group_analytic_accounting'): - buttons.append({ - 'icon': 'usd', - 'text': _lt('Gross Margin'), - 'number': format_amount(self.env, self.analytic_account_balance, self.company_id.currency_id), - 'action_type': 'object', - 'action': 'action_view_analytic_account_entries', - 'show': bool(self.analytic_account_id), - 'sequence': 24, - }) return buttons # --------------------------------------------------- diff --git a/addons/project_hr_expense/models/project.py b/addons/project_hr_expense/models/project.py index 941d4c0f8de..aec4ebd16b0 100644 --- a/addons/project_hr_expense/models/project.py +++ b/addons/project_hr_expense/models/project.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. -from odoo import api, fields, models, _, _lt +from odoo import api, fields, models, _ class Project(models.Model): _inherit = 'project.project' @@ -39,21 +39,3 @@ class Project(models.Model): action["views"] = [[False, 'form']] action["res_id"] = expenses.id return action - - # ---------------------------- - # Project Updates - # ---------------------------- - - def _get_stat_buttons(self): - buttons = super(Project, self)._get_stat_buttons() - if self.user_has_groups('hr_expense.group_hr_expense_team_approver'): - buttons.append({ - 'icon': 'money', - 'text': _lt('Expenses'), - 'number': self.expenses_count, - 'action_type': 'object', - 'action': 'action_open_project_expenses', - 'show': self.expenses_count > 0, - 'sequence': 33, - }) - return buttons diff --git a/addons/project_mrp/models/project.py b/addons/project_mrp/models/project.py index 2086c1cf53e..9c7595d8215 100644 --- a/addons/project_mrp/models/project.py +++ b/addons/project_mrp/models/project.py @@ -40,24 +40,6 @@ class Project(models.Model): buttons = super(Project, self)._get_stat_buttons() if self.user_has_groups('mrp.group_mrp_user'): buttons.extend([{ - 'icon': 'wrench', - 'text': _lt('Manufacturing Orders'), - 'number': self.production_count, - 'action_type': 'object', - 'action': 'action_view_mrp_production', - 'show': self.production_count > 0, - 'sequence': 39, - }, - { - 'icon': 'cog', - 'text': _lt('Work Orders'), - 'number': self.workorder_count, - 'action_type': 'object', - 'action': 'action_view_workorder', - 'show': self.workorder_count > 0, - 'sequence': 42, - }, - { 'icon': 'flask', 'text': _lt('Bills of Materials'), 'number': self.bom_count, diff --git a/addons/sale_timesheet/models/project.py b/addons/sale_timesheet/models/project.py index bff2f861db0..b567689b934 100644 --- a/addons/sale_timesheet/models/project.py +++ b/addons/sale_timesheet/models/project.py @@ -1,10 +1,9 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. -import json from collections import defaultdict -from odoo import api, fields, models, _, _lt +from odoo import api, fields, models, _ from odoo.osv import expression from odoo.exceptions import ValidationError, UserError from odoo.tools import format_amount, float_is_zero, formatLang @@ -437,23 +436,6 @@ class Project(models.Model): }) return result - def _get_stat_buttons(self): - buttons = super(Project, self)._get_stat_buttons() - if self.user_has_groups('hr_timesheet.group_hr_timesheet_approver'): - buttons.append({ - 'icon': 'clock-o', - 'text': _lt('Billable Time'), - 'number': '%s %%' % (self.billable_percentage), - 'action_type': 'object', - 'action': 'action_billable_time_button', - 'additional_context': json.dumps({ - 'active_id': self.id, - 'default_project_id': self.id - }), - 'show': self.allow_timesheets and bool(self.analytic_account_id), - 'sequence': 9, - }) - return buttons class ProjectTask(models.Model): _inherit = "project.task"