From 391d7c1614dd48daadcd87b719d24bcc1405630c Mon Sep 17 00:00:00 2001 From: Florian Mounier Date: Tue, 5 Mar 2024 16:29:33 +0100 Subject: [PATCH] [LINT] --- project_workload/models/project_task_workload.py | 2 +- project_workload_additions/models/project_task.py | 3 ++- project_workload_additions/models/project_workload_unit.py | 3 ++- .../views/project_task_workload_view.xml | 5 ++++- project_workload_capacity/__manifest__.py | 1 + project_workload_milestone/models/project_milestone.py | 3 ++- project_workload_milestone/views/project_milestone.xml | 1 + project_workload_timesheet/models/account_analytic_line.py | 4 +--- project_workload_timesheet/models/project_workload_unit.py | 1 - .../views/hr_timesheet_sheet_views.xml | 2 +- .../models/account_analytic_line.py | 3 +-- .../models/hr_timesheet_sheet.py | 2 +- .../odoo/addons/project_workload_timesheet_additions | 1 + setup/project_workload_timesheet_additions/setup.py | 6 ++++++ 14 files changed, 24 insertions(+), 13 deletions(-) create mode 120000 setup/project_workload_timesheet_additions/odoo/addons/project_workload_timesheet_additions create mode 100644 setup/project_workload_timesheet_additions/setup.py diff --git a/project_workload/models/project_task_workload.py b/project_workload/models/project_task_workload.py index 1d6d43c17..d7ae440bf 100644 --- a/project_workload/models/project_task_workload.py +++ b/project_workload/models/project_task_workload.py @@ -17,7 +17,7 @@ def week_name(value): return None -week_merge_re = re.compile((r"(\d{4})-(\d{2}) - (\1)-(\d{2})")) +week_merge_re = re.compile(r"(\d{4})-(\d{2}) - (\1)-(\d{2})") class ProjectTaskWorkload(models.Model): diff --git a/project_workload_additions/models/project_task.py b/project_workload_additions/models/project_task.py index 9017f98ef..35827668a 100644 --- a/project_workload_additions/models/project_task.py +++ b/project_workload_additions/models/project_task.py @@ -31,7 +31,8 @@ def _get_new_workloads(self): return rv def _get_updated_workloads(self): - # We sort the workloads by additional_workload_id to ensure that the first workload is the main one + # We sort the workloads by additional_workload_id to ensure that the + # first workload is the main one self.workload_ids = self.workload_ids.sorted( key=lambda w: w.additional_workload_id ) diff --git a/project_workload_additions/models/project_workload_unit.py b/project_workload_additions/models/project_workload_unit.py index 105fb25d4..34e21f896 100644 --- a/project_workload_additions/models/project_workload_unit.py +++ b/project_workload_additions/models/project_workload_unit.py @@ -15,7 +15,8 @@ def name_get(self): for unit_id, name in result: unit = self.browse(unit_id) if unit.workload_id.additional_workload_id: - name = f"{unit.workload_id.additional_workload_id.task_id.name} {_('of')} {name}" + name = f"{unit.workload_id.additional_workload_id.task_id.name} " + f"{_('of')} {name}" units_names[unit_id] = name return list(units_names.items()) diff --git a/project_workload_additions/views/project_task_workload_view.xml b/project_workload_additions/views/project_task_workload_view.xml index e3727b55f..d16b68992 100644 --- a/project_workload_additions/views/project_task_workload_view.xml +++ b/project_workload_additions/views/project_task_workload_view.xml @@ -3,7 +3,10 @@ project.task.workload - + diff --git a/project_workload_capacity/__manifest__.py b/project_workload_capacity/__manifest__.py index 2cf75ca32..a35466481 100644 --- a/project_workload_capacity/__manifest__.py +++ b/project_workload_capacity/__manifest__.py @@ -23,4 +23,5 @@ "views/project_load_capacity_report_view.xml", "views/menu_view.xml", ], + "installable": False, } diff --git a/project_workload_milestone/models/project_milestone.py b/project_workload_milestone/models/project_milestone.py index c1e3617a1..a1346e5ea 100644 --- a/project_workload_milestone/models/project_milestone.py +++ b/project_workload_milestone/models/project_milestone.py @@ -46,4 +46,5 @@ def _compute_milestone_start_date(self): limit=1, ) # The start date will be the end date of the previous milestone - record.start_date = previous_milestones.target_date + timedelta(days=1) + if previous_milestones.target_date: + record.start_date = previous_milestones.target_date + timedelta(days=1) diff --git a/project_workload_milestone/views/project_milestone.xml b/project_workload_milestone/views/project_milestone.xml index a0fb1614b..c3e7220c5 100644 --- a/project_workload_milestone/views/project_milestone.xml +++ b/project_workload_milestone/views/project_milestone.xml @@ -7,6 +7,7 @@ project.milestone + diff --git a/project_workload_timesheet/models/account_analytic_line.py b/project_workload_timesheet/models/account_analytic_line.py index c378f66fd..11fbd1826 100644 --- a/project_workload_timesheet/models/account_analytic_line.py +++ b/project_workload_timesheet/models/account_analytic_line.py @@ -2,9 +2,7 @@ # @author Florian Mounier # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -from odoo import _, api, fields, models -from odoo.exceptions import UserError, ValidationError - +from odoo import api, fields, models from odoo.addons.project_workload.models.project_task_workload import week_name diff --git a/project_workload_timesheet/models/project_workload_unit.py b/project_workload_timesheet/models/project_workload_unit.py index 020bf7020..3a8f39b51 100644 --- a/project_workload_timesheet/models/project_workload_unit.py +++ b/project_workload_timesheet/models/project_workload_unit.py @@ -83,7 +83,6 @@ def action_timesheet_time(self): def action_timesheet_done(self): self.done = True - pass def _get_timesheeting_task(self): # For overrides diff --git a/project_workload_timesheet/views/hr_timesheet_sheet_views.xml b/project_workload_timesheet/views/hr_timesheet_sheet_views.xml index 1dbfa2f13..5a95f632e 100644 --- a/project_workload_timesheet/views/hr_timesheet_sheet_views.xml +++ b/project_workload_timesheet/views/hr_timesheet_sheet_views.xml @@ -74,7 +74,7 @@ widget="progressbar" optional="show" /> - + # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -from odoo import _, api, fields, models -from odoo.exceptions import UserError, ValidationError +from odoo import fields, models class AccountAnalyticLine(models.Model): diff --git a/project_workload_timesheet_additions/models/hr_timesheet_sheet.py b/project_workload_timesheet_additions/models/hr_timesheet_sheet.py index b9bcd8b40..34aa71be9 100644 --- a/project_workload_timesheet_additions/models/hr_timesheet_sheet.py +++ b/project_workload_timesheet_additions/models/hr_timesheet_sheet.py @@ -1,7 +1,7 @@ # Copyright 2024 Akretion (https://www.akretion.com). # @author Florian Mounier # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -from odoo import api, fields, models +from odoo import models class Sheet(models.Model): diff --git a/setup/project_workload_timesheet_additions/odoo/addons/project_workload_timesheet_additions b/setup/project_workload_timesheet_additions/odoo/addons/project_workload_timesheet_additions new file mode 120000 index 000000000..b6e9a6a5c --- /dev/null +++ b/setup/project_workload_timesheet_additions/odoo/addons/project_workload_timesheet_additions @@ -0,0 +1 @@ +../../../../project_workload_timesheet_additions \ No newline at end of file diff --git a/setup/project_workload_timesheet_additions/setup.py b/setup/project_workload_timesheet_additions/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/project_workload_timesheet_additions/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)