diff --git a/project_workload/models/project_task_workload.py b/project_workload/models/project_task_workload.py index 1d6d43c1..d7ae440b 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 9017f98e..35827668 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 105fb25d..34e21f89 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 e3727b55..d16b6899 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_milestone/models/project_milestone.py b/project_workload_milestone/models/project_milestone.py index c1e3617a..a1346e5e 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 a0fb1614..c3e7220c 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 c378f66f..11fbd182 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 020bf702..3a8f39b5 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 1dbfa2f1..5a95f632 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 b9bcd8b4..34aa71be 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 00000000..b6e9a6a5 --- /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 00000000..28c57bb6 --- /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, +)