Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TA#72164 [16.0][MIG] project_milestone_estimated_hours #474

Merged
merged 10 commits into from
Dec 17, 2024
12 changes: 6 additions & 6 deletions .docker_files/main/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@
"category": "Other",
"summary": "Install all addons required for testing.",
"depends": [
"project",
"project_default_task_stage",
"project_milestone_enhanced",
"project_milestone_estimated_hours",
"project_milestone_spent_hours",
"project_parent_enhanced",
"project_stage_allow_timesheet",
"project_task_date_planned",
"project_task_deadline_from_project",
"project_task_editable_list_view",
"project_task_full_text_search",
"project_track_end_date",
"project_type_advanced",
"project_default_task_stage",
"project_milestone_enhanced",
"project_milestone_spent_hours",
"project_parent_enhanced",
"project_stage_allow_timesheet",
],
"installable": True,
}
11 changes: 5 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,18 @@ RUN gitoo install-all --conf_file /gitoo.yml --destination "${THIRD_PARTY_ADDONS

USER odoo

COPY project_stage_allow_timesheet mnt/extra-addons/project_stage_allow_timesheet
COPY project_default_task_stage /mnt/extra-addons/project_default_task_stage
COPY project_milestone_enhanced /mnt/extra-addons/project_milestone_enhanced
COPY project_milestone_estimated_hours /mnt/extra-addons/project_milestone_estimated_hours
COPY project_milestone_spent_hours /mnt/extra-addons/project_milestone_spent_hours
COPY project_parent_enhanced mnt/extra-addons/project_parent_enhanced
COPY project_stage_allow_timesheet mnt/extra-addons/project_stage_allow_timesheet
COPY project_task_date_planned /mnt/extra-addons/project_task_date_planned
COPY project_task_deadline_from_project /mnt/extra-addons/project_task_deadline_from_project
COPY project_task_editable_list_view /mnt/extra-addons/project_task_editable_list_view
COPY project_task_full_text_search /mnt/extra-addons/project_task_full_text_search
COPY project_track_end_date /mnt/extra-addons/project_track_end_date
COPY project_type_advanced /mnt/extra-addons/project_type_advanced
COPY project_default_task_stage /mnt/extra-addons/project_default_task_stage
COPY project_milestone_enhanced /mnt/extra-addons/project_milestone_enhanced
COPY project_milestone_spent_hours /mnt/extra-addons/project_milestone_spent_hours



COPY .docker_files/main /mnt/extra-addons/main
COPY .docker_files/odoo.conf /etc/odoo
40 changes: 40 additions & 0 deletions project_milestone_estimated_hours/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
Project Milestone Estimated Hours
=================================

.. contents:: Table of Contents

Context
-------
Natively, Odoo allows to define milestones for a project.

Multiple tasks in the project can be linked to a given milestone.


Description
-----------
Field estimated hours is displayed in form and list view of a project milestone and in tab of milestones of a project.
when a milestone is copied, value of estimated hours is copied too.

Overview
--------

I open the form of a project milestone and set value in field "Estimated hours.

.. image:: static/description/project_milestone_form.png

I copy the milestone and value in field "Estimated hours is the same.

.. image:: static/description/project_milestone_copy.png

I open the list of milestones, the field is displayed.

.. image:: static/description/project_milestone_tree.png

I open the form of a project with notebook milestones, the field is displayed.

.. image:: static/description/project_form.png


Contributors
------------
* Numigi (tm) and all its contributors (https://bit.ly/numigiens)
4 changes: 4 additions & 0 deletions project_milestone_estimated_hours/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright 2023 - today Numigi (tm) and all its contributors (https://bit.ly/numigiens)
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from . import models

Check notice on line 4 in project_milestone_estimated_hours/__init__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

project_milestone_estimated_hours/__init__.py#L4

'.models' imported but unused (F401)
18 changes: 18 additions & 0 deletions project_milestone_estimated_hours/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2023 - today Numigi (tm) and all its contributors (https://bit.ly/numigiens)
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
{

Check warning on line 3 in project_milestone_estimated_hours/__manifest__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

project_milestone_estimated_hours/__manifest__.py#L3

Statement seems to have no effect
"name": "Project Milestone Estimated Hours",
"version": "16.0.1.0.0",
"author": "Numigi",
"maintainer": "Numigi",
"website": "https://bit.ly/numigi-com",
"license": "LGPL-3",
"category": "Project",
"summary": "Add possibility to set estimated hours in a project milestone",
"depends": ["project_milestone_enhanced"],
"data": [
"views/project_milestone.xml",
"views/project.xml",
],
"installable": True,
}
26 changes: 26 additions & 0 deletions project_milestone_estimated_hours/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * project_milestone_estimated_hours
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-12-07 04:32+0000\n"
"PO-Revision-Date: 2024-12-07 04:32+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: project_milestone_estimated_hours
#: model:ir.model.fields,field_description:project_milestone_estimated_hours.field_project_milestone__estimated_hours
msgid "Estimated Hours"
msgstr "Heures estimées"

#. module: project_milestone_estimated_hours
#: model:ir.model,name:project_milestone_estimated_hours.model_project_milestone
msgid "Project Milestone"
msgstr "Jalon"
4 changes: 4 additions & 0 deletions project_milestone_estimated_hours/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright 2023 - today Numigi (tm) and all its contributors (https://bit.ly/numigiens)
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from . import project_milestone

Check notice on line 4 in project_milestone_estimated_hours/models/__init__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

project_milestone_estimated_hours/models/__init__.py#L4

'.project_milestone' imported but unused (F401)
10 changes: 10 additions & 0 deletions project_milestone_estimated_hours/models/project_milestone.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright 2023 - today Numigi (tm) and all its contributors (https://bit.ly/numigiens)
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from odoo import fields, models


class ProjectMilestone(models.Model):
_inherit = "project.milestone"

estimated_hours = fields.Float(string="Estimated Hours")
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions project_milestone_estimated_hours/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright 2023 - today Numigi (tm) and all its contributors (https://bit.ly/numigiens)
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from . import test_estimated_hours
25 changes: 25 additions & 0 deletions project_milestone_estimated_hours/tests/test_estimated_hours.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2023 - today Numigi (tm) and all its contributors (https://bit.ly/numigiens)
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from odoo.tests.common import TransactionCase


class TestEstimatedHours(TransactionCase):
def setUp(self):
super().setUp()
self.project = self.env["project.project"].create(
{"name": "My Project", "allow_milestones": True}
)
self.milestone = self.env["project.milestone"].create(
{
"name": "My Milestone",
"estimated_hours": 10,
"project_id": self.project.id,
}
)
self.milestone_copy = self.milestone.copy()

def test_estimated_hours_copy(self):
assert (
self.milestone.estimated_hours == self.milestone_copy.estimated_hours == 10
)
16 changes: 16 additions & 0 deletions project_milestone_estimated_hours/views/project.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<!-- Form View -->
<record id="project_milestone_estimated_hours_view_form" model="ir.ui.view">
<field name="name">Project Milestone Estimated Hours Form</field>
<field name="model">project.project</field>
<field name="inherit_id" ref="project_milestone_enhanced.project_active_view_form" />
<field name="type">form</field>
<field name="arch" type="xml">
<xpath expr="//field[@name='milestone_ids']/tree/field[@name='task_ids']" position="after">
<field name="estimated_hours" />
</xpath>
</field>
</record>

</odoo>
36 changes: 36 additions & 0 deletions project_milestone_estimated_hours/views/project_milestone.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<!-- List View-->
<record id="project_milestone_estimated_hours_view_list" model="ir.ui.view">
<field name="name">Project Milestone Estimated Hours List</field>
<field name="model">project.milestone</field>
<field name="inherit_id" ref="project_milestone_enhanced.project_milestone_view_list" />
<field name="arch" type="xml">
<field name="task_ids" position="after">
<field name="estimated_hours" widget="float_time" />
</field>
</field>
</record>

<!-- Form View -->
<record id="project_milestone_estimated_hours_form" model="ir.ui.view">
<field name="name">Project Milestone Estimated Hours Form</field>
<field name="model">project.milestone</field>
<field name="inherit_id" ref="project.project_milestone_view_form" />
<field name="arch" type="xml">
<field name="deadline" position="replace" />

<xpath expr="//group" position="before">
<group>
<group>
<field name="deadline" />
</group>
<group>
<field name="estimated_hours" widget="float_time" />
</group>
</group>
</xpath>
</field>
</record>

</odoo>
Loading