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#73501 [14.0][MIG] project_cost_report #502

Open
wants to merge 8 commits into
base: 14.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .docker_files/main/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"project_analytic_group",
"project_chatter",
"project_closed",
"project_cost_report",
"project_cost_smart_button",
"project_default_task_stage",
"project_enhanced",
Expand Down
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ COPY project_advanced_checklist /mnt/extra-addons/project_advanced_checklist
COPY project_analytic_group /mnt/extra-addons/project_analytic_group
COPY project_chatter /mnt/extra-addons/project_chatter
COPY project_closed /mnt/extra-addons/project_closed
COPY project_cost_report /mnt/extra-addons/project_cost_report
COPY project_cost_smart_button /mnt/extra-addons/project_cost_smart_button
COPY project_default_task_stage /mnt/extra-addons/project_default_task_stage
COPY project_enhanced /mnt/extra-addons/project_enhanced
Expand Down
196 changes: 196 additions & 0 deletions project_cost_report/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
Project Cost Report
===================

.. contents:: Table of Contents

Summary
-------
This module adds a dynamic cost report to the `Project` application.

.. image:: static/description/report_overview.png

Usage
-----
To open the report, go to the form view of a project and click on the smart button `Cost Report`

.. image:: static/description/project_smart_button.png

Header
------
The header of the report contains the following elements:

1. The print date
2. The name of the partner related to the project
3. The project name
4. The project type (see module project_type from the same repository)

.. image:: static/description/report_overview.png

Cost Sections
-------------
The body of the report is divided into 2 tables.

The first table contains the costs of the the project.
The amounts are aggregations based on analytic lines.

.. image:: static/description/report_costs.png

These costs are seperated into the following sections:

* Products
* Time
* Outsourcing

Each section contains subdivisions that can be folded / unfolded to show / hide the details (analytic lines).

.. image:: static/description/report_subdivision_unfold.png

By clicking on the amount of a subdivision, the list of analytic lines related to this amount is displayed.

.. image:: static/description/subdivision_amount_click.png

.. image:: static/description/analytic_line_list.png

By clicking on an analytic line, the form view of the analytic line is opened.

.. image:: static/description/analytic_line_click.png

.. image:: static/description/analytic_line_form.png

Cost Subdivisions (Categories)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The complete list of subdivision (categories) found in the report is available under ``Project / Configuration``.

.. image:: static/description/cost_category_list.png

Products
~~~~~~~~
This section contains analytic lines with stockable or consumable products.

It is subdivided into cost categories.

.. image:: static/description/report_section_products.png

These cost categories are defined on product categories.

.. image:: static/description/product_category_form.png

..

The subdivision `Products` is a default category. It includes all products not bound to a specific cost category.

Time
~~~~
This section contains analytic lines from timesheets.

It is subdivided into cost categories.

.. image:: static/description/report_section_time.png

These categories are defined on task types (see module project_task_type from the same repository).

.. image:: static/description/task_type_form.png

..

The subdivision `Labour` is a default category. It contains all timesheet lines not bound to a specific category.

Employee Column
***************
Since version 1.1.0 of the module, the ``Employee`` is shown in the ``Time`` section.

.. image:: static/description/report_employee_column.png

Outsourcing
~~~~~~~~~~~
This section contains analytic lines with products of type service that are not timesheets.

It contains only one subdivision with the same name.

.. image:: static/description/report_section_outsourcing.png

Unreceived Invoices
-------------------
The report contains a special section named `WAITING FOR INVOICES`.

This section contains a list of purchase orders related to the project
for which the supplier invoice has not been received.

.. image:: static/description/report_unreceived_invoices.png

The amount displayed on each line is computed as follow:

..

(Ordered Quantity - Invoiced Quantity) * Unit Price

By clicking on the PO number, the form view of the PO is opened.

.. image:: static/description/purchase_order_form.png

Fold / Unfold
-------------
You may fold or unfold every sections of the report by clicking on the
buttons in the control panel of the report.

.. image:: static/description/unfold_button.png

Target / Suggested / Profit
---------------------------
Since the version 1.3.0 of the module, 3 new columns are added to the report.

.. image:: static/description/report_summary_columns.png

These columns show respectively:

* the target sale margin
* the suggested sale price based on the target margin
* the profit based on the suggested sale price

Target Ratios
~~~~~~~~~~~~~
Under each sections (except TIME), the target is a margin ratio.

.. image:: static/description/product_section_target.png

This ratio is defined on the cost category.

.. image:: static/description/product_category_sale_ratio.png

Target Hourly Rate
~~~~~~~~~~~~~~~~~~
Under the TIME section, the target is an hourly rate.

.. image:: static/description/time_section_target.png

This hourly rate is defined on the cost category.

.. image:: static/description/time_category_hourly_rate.png

Since version 1.4.0 of the module, it is also possible to define a target in percentage
(instead of an hourly rate) for time categories.

.. image:: static/description/time_category_percentage_target.png

.. image:: static/description/report_with_time_percentage_target.png

Hide / Show Summary
~~~~~~~~~~~~~~~~~~~
The 3 columns Target / Suggested / Profit can be hidden by clicking on ``HIDE SUMMARY``

.. image:: static/description/hide_summary_button.png

They can be displayed again by clicking on ``SHOW SUMMARY``.

.. image:: static/description/show_summary_button.png

PDF Version
-----------
You may print or doaload a PDF version of the report by clicking on the `PRINT` button
in the control panel of the report.

.. image:: static/description/print_button.png

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

from . import report

Check notice on line 4 in project_cost_report/__init__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

project_cost_report/__init__.py#L4

'.report' imported but unused (F401)
from . import controller

Check notice on line 5 in project_cost_report/__init__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

project_cost_report/__init__.py#L5

'.controller' imported but unused (F401)
from . import models

Check notice on line 6 in project_cost_report/__init__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

project_cost_report/__init__.py#L6

'.models' imported but unused (F401)
33 changes: 33 additions & 0 deletions project_cost_report/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright 2019 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 4 in project_cost_report/__manifest__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

project_cost_report/__manifest__.py#L4

Statement seems to have no effect
"name": "Project Cost Report",
"version": "16.0.0.1.0.0",
"author": "Numigi",
"maintainer": "Numigi",
"website": "https://bit.ly/numigi-com",
"license": "LGPL-3",
"category": "Project",
"summary": "Add a dynamic cost report to projects",
"depends": [
"analytic_line_revenue",
"project_task_analytic_lines",
"project_task_type",
"project_type",
"purchase",
"project_wip_supply_cost",
],
"data": [
"data/project_cost_category.xml",
"report/report.xml",
"security/ir.model.access.csv",
"views/project_project_views.xml",
"views/assets.xml",
"views/project_cost_category_views.xml",
"views/product_category_views.xml",
"views/task_type_views.xml",
],
"qweb": ["static/src/xml/templates.xml"],
"installable": True,
}
4 changes: 4 additions & 0 deletions project_cost_report/controller/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright 2019 Numigi (tm) and all its contributors (https://bit.ly/numigiens)
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from . import print_report

Check notice on line 4 in project_cost_report/controller/__init__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

project_cost_report/controller/__init__.py#L4

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

import json
from odoo import http
from odoo.http import request


class PrintProjectCostReport(http.Controller):
@http.route("/web/project_cost_report/<int:project_id>", type="http", auth="user")
def project_cost_report_pdf(self, project_id, report_context, token):
"""Print the PDF version of the cost report.

:param int project_id: the ID of the project
:param dict report_context: the rendering context of the report
:param str token: the user token
:rtype: Response
"""
report_context = json.loads(report_context)
output_pdf = request.env["project.cost.report"].get_pdf(report_context)
response = request.make_response(
output_pdf,
headers=[
("Content-Type", "application/pdf"),
(
"Content-Disposition",
"attachment; filename=project_cost_report.pdf;",
),
],
)
response.set_cookie("fileToken", token)
return response
24 changes: 24 additions & 0 deletions project_cost_report/data/project_cost_category.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo noupdate="1">

<record id="cost_category_product" model="project.cost.category">
<field name="name">Products</field>
<field name="section">products</field>
</record>

<record id="cost_category_labour" model="project.cost.category">
<field name="name">Labour</field>
<field name="section">time</field>
</record>

<record id="cost_category_outsourcing" model="project.cost.category">
<field name="name">Outsourcing</field>
<field name="section">outsourcing</field>
</record>

<record id="cost_category_supply" model="project.cost.category">
<field name="name">Shop Supply</field>
<field name="section">supply</field>
</record>

</odoo>
Loading
Loading