[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
This commit is contained in:
Xavier BOL (xbo)
2022-04-01 15:32:59 +02:00
committed by Laurent Stukkens (LTU)
parent 6c3bbdbef8
commit 80bf615bbb
5 changed files with 3 additions and 86 deletions
+1 -19
View File
@@ -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"
-11
View File
@@ -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
# ---------------------------------------------------
+1 -19
View File
@@ -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
-18
View File
@@ -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,
+1 -19
View File
@@ -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"