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#61352 [MIG] project_invoicing_profile : migration to 14.0 #376

Open
wants to merge 1 commit 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 @@ -27,6 +27,7 @@
"project_form_with_dates",
"project_group_create",
"project_hide_create_sale_order",
"project_invoicing_profile",
"project_iteration",
"project_iteration_parent_only",
"project_iteration_parent_type_required",
Expand Down
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ COPY project_enhanced /mnt/extra-addons/project_enhanced
COPY project_form_with_dates /mnt/extra-addons/project_form_with_dates
COPY project_group_create /mnt/extra-addons/project_group_create
COPY project_hide_create_sale_order /mnt/extra-addons/project_hide_create_sale_order
COPY project_invoicing_profile /mnt/extra-addons/project_invoicing_profile
COPY project_iteration /mnt/extra-addons/project_iteration
COPY project_iteration_parent_only /mnt/extra-addons/project_iteration_parent_only
COPY project_iteration_parent_type_required /mnt/extra-addons/project_iteration_parent_type_required
Expand Down
44 changes: 44 additions & 0 deletions project_invoicing_profile/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
Project Invocing Profile
========================
This module allows users to be able to know the typology of projects :
- Analyze and break down time spent by type of project
- Identify the times to be re-invoiced and under what structure, both for customers and for inter-company invoicing.

Usage
-----
*Configuration*
As a user of the Administration / Configuration group, from the Technical menu, I find the submenu: Technical / Parameters.
Then after activating in the user profile form view, in the Other section: `Project invoicing profile`.
Now, I can have view the new submenu : `Technical / Parameters / Project invoicing profile`.

When I click on the menu entry, I arrive at a non-editable list which offers the Name field.

If I click on the [Create] button, I arrive at a form view allowing me to create, modify and delete records.
The form view displays the following fields:
- Name
- Description

There is no possibility of archiving.
This is to prevent data from being archived even though it is defined on projects, tasks and timesheets.
If the administrator wishes to change the data, he will either have to modify an existing record,
or modify by batch editing to reassign the values ​​to the projects before deleting a billing profile.

It is impossible for a user to delete data if it is set on a record linked via a many2one field.

*Access right*
A new access group is created `Project invoicing profile`.

A new extended security rule is added through the module, and restricts the modification of the field on the project form to the 'Project billing profiles' group only.

*Use case*
As a user of the `Project invoicing profile` group, from the project form, in the tab:

From the list of tasks and timelines, I can group by `Invoicing profile`.
The task and timeline field is a related field, based on the project.
It is not editable or visible in list and form views.
It is simply stored in the database and available for group, filter, or export.


Contributors
------------
* Numigi (tm) and all its contributors (https://bit.ly/numigiens)
4 changes: 4 additions & 0 deletions project_invoicing_profile/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# © 2024 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_invoicing_profile/__init__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

project_invoicing_profile/__init__.py#L4

'.models' imported but unused (F401)
20 changes: 20 additions & 0 deletions project_invoicing_profile/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# © 2024 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_invoicing_profile/__manifest__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

project_invoicing_profile/__manifest__.py#L4

Statement seems to have no effect
"name": "Project Invoicing Profile",
"version": "14.0.1.0.0",
"author": "Numigi",
"maintainer": "Numigi",
"license": "LGPL-3",
"category": "Project",
"summary": "Add invoicing profiles to projects",
"depends": ["project", "hr_timesheet"],
"data": [
"security/groups.xml",
"views/project_invoice_profile.xml",
"views/project_project.xml",
"security/ir.model.access.csv",
],
"installable": True,
}
53 changes: 53 additions & 0 deletions project_invoicing_profile/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * project_invoicing_profile
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-03-22\n"
"PO-Revision-Date: 2024-03-22\n"
"Last-Translator: <Numigi- Abdel>\n"
"Language-Team: \n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: \n"
"X-Generator: Poedit 2.0.6\n"

#. module: project_invoicing_profile
#: model:ir.model.fields,field_description:project_invoicing_profile.field_project_invoice_profile__name
msgid "Name"
msgstr "Nom"

#. module: project_invoicing_profile
#: model:ir.model.fields,field_description:project_invoicing_profile.field_project_invoice_profile__note
msgid "Description"
msgstr "Description"

#. module: project_invoicing_profile
#: model:ir.model.fields,field_description:project_invoicing_profile.field_project_project__invoicing_profile_id
#: model:ir.model.fields,field_description:project_invoicing_profile.field_project_task__invoicing_profile_id
#: model:ir.model.fields,field_description:project_invoicing_profile.field_account_analytic_line__invoicing_profile_id
#: model_terms:ir.ui.view,arch_db:project_invoicing_profile.edit_project_invoicing_profile_search
#: model_terms:ir.ui.view,arch_db:project_invoicing_profile.view_task_invoicing_profile_search
#: model_terms:ir.ui.view,arch_db:project_invoicing_profile.view_timesheet_invoicing_profile_search
msgid "Invoicing profile"
msgstr "Profil de facturation"



#. module: project_invoicing_profile
#: model:ir.actions.act_window,name:project_invoicing_profile.action_project_invoice_profile
#: model:ir.ui.menu,name:project_invoicing_profile.menu_project_invoice_profile
#: model:res.groups,name:project_invoicing_profile.group_project_invoicing_profile
msgid "Project invoicing profile"
msgstr "Profils de facturation des projets"


#. module: project_invoicing_profile
#: model:res.groups,comment:project_invoicing_profile.group_project_invoicing_profile
msgid "Grants access to create project invoicing profile"
msgstr "Donne l'accés à la création des profils de de facturation des projets"
4 changes: 4 additions & 0 deletions project_invoicing_profile/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# © 2024 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_invoicing_profile

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

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

project_invoicing_profile/models/__init__.py#L4

'.project_invoicing_profile' imported but unused (F401)
43 changes: 43 additions & 0 deletions project_invoicing_profile/models/project_invoicing_profile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# © 2024 - 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 ProjectInvoiceProfile(models.Model):

_name = "project.invoice.profile"

name = fields.Char(string="Name", required=True)
note = fields.Text(string="Description")


class Project(models.Model):

_inherit = "project.project"

invoicing_profile_id = fields.Many2one(
"project.invoice.profile", string="Invoicing profile", ondelete="restrict"
)


class ProjectTask(models.Model):

_inherit = "project.task"

invoicing_profile_id = fields.Many2one(
related="project_id.invoicing_profile_id",
string="Invoicing profile",
store=True,
)


class AccountAnalyticLine(models.Model):

_inherit = "account.analytic.line"

invoicing_profile_id = fields.Many2one(
related="project_id.invoicing_profile_id",
string="Invoicing profile",
store=True,
)
9 changes: 9 additions & 0 deletions project_invoicing_profile/security/groups.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>

<record id="group_project_invoicing_profile" model="res.groups">
<field name="name">Project invoicing profile</field>
<field name="comment">Grants access to create project invoicing profile</field>
</record>

</odoo>
2 changes: 2 additions & 0 deletions project_invoicing_profile/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_project_invoice_profile,Project invoice profile : Manager,model_project_invoice_profile,group_project_invoicing_profile,1,1,1,1
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.
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_invoicing_profile/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# © 2024 - 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_project_invoice_profile
56 changes: 56 additions & 0 deletions project_invoicing_profile/tests/test_project_invoice_profile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@

from odoo.tests.common import SavepointCase
from psycopg2 import IntegrityError


class TestProjectInvoiceProfile(SavepointCase):

@classmethod
def setUpClass(cls):
super(TestProjectInvoiceProfile, cls).setUpClass()

user_group_employee = cls.env.ref('base.group_user')
user_group_project_user = cls.env.ref('project.group_project_user')
user_group_project_manager = cls.env.ref('project.group_project_manager')
user_group_project_profile = cls.env.ref('project_invoicing_profile.group_project_invoicing_profile')

cls.profile_1 = cls.env['project.invoice.profile'].create({
'name': 'Numigi',
'note': 'Projet Numigi'})
cls.profile_2 = cls.env['project.invoice.profile'].create({
'name': 'Kolabus',
'note': 'Projet Kolabus'})

# Test users to use through the various tests
Users = cls.env['res.users'].with_context({'no_reset_password': True})

cls.user_projectuser = Users.create({
'name': 'ProjectUser',
'login': 'ProjectUser',
'email': '[email protected]',
'groups_id': [(6, 0, [user_group_employee.id, user_group_project_user.id])]
})
cls.user_projectmanager = Users.create({
'name': 'ProjectManager',
'login': 'ProjectManager',
'email': '[email protected]',
'groups_id': [(6, 0, [user_group_employee.id, user_group_project_manager.id,
user_group_project_profile.id])]})

cls.project_1 = cls.env['project.project'].with_context({'mail_create_nolog': True}).create({
'name': 'Project1',
'invoicing_profile_id': cls.profile_1.id
})

cls.task_1 = cls.env['project.task'].with_context({'mail_create_nolog': True}).create({
'name': 'Task1',
'user_id': cls.user_projectuser.id,
'project_id': cls.project_1.id})

def test_delete_assigned_project_invoicing_profile(self):
"""User should never be able to delete an assigned project profil """
with self.assertRaises(IntegrityError):
self.profile_1.unlink()

def test_project_invoicing_profile_on_task(self):
assert self.task_1.invoicing_profile_id == self.project_1.invoicing_profile_id
74 changes: 74 additions & 0 deletions project_invoicing_profile/views/project_invoice_profile.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>

<record id="view_project_invoice_profile_tree" model="ir.ui.view">
<field name="name">project.invoice.profile.tree</field>
<field name="model">project.invoice.profile</field>
<field name="type">tree</field>
<field name="mode">primary</field>
<field name="priority" eval="16" />
<field name="active" eval="True" />
<field name="arch" type="xml">
<tree string="profile tree" create="true" delete="true" edit="true">
<field name="name" />

</tree>
</field>
</record>

<record id="view_project_invoice_profile_form" model="ir.ui.view">
<field name="name">project.invoice.profile.form</field>
<field name="model">project.invoice.profile</field>
<field name="type">form</field>
<field name="mode">primary</field>
<field name="priority" eval="16" />
<field name="active" eval="True" />
<field name="arch" type="xml">
<form string="profile form" create="true" delete="true" edit="true">
<header>
</header>
<sheet>
<div class="oe_title">
<label for="name" class="oe_edit_only" />
<h1>
<field name="name" class="oe_inline"
placeholder="name" />
</h1>
</div>
<group>
<field name="note" />
</group>
</sheet>
</form>
</field>
</record>

<record id="view_project_invoice_profile_search" model="ir.ui.view">
<field name="name">project.invoice.profile.search</field>
<field name="model">project.invoice.profile</field>
<field name="type">search</field>
<field name="mode">primary</field>
<field name="priority" eval="16" />
<field name="active" eval="True" />
<field name="arch" type="xml">
<search string="profile search">
<field name="name" />

</search>
</field>
</record>

<record id="action_project_invoice_profile" model="ir.actions.act_window">
<field name="name">Project invoicing profile</field>
<field name="res_model">project.invoice.profile</field>
<field name="view_mode">tree,form</field>
<field name="target">current</field>
</record>



<menuitem id="menu_project_invoice_profile" name="Project invoicing profile" parent="project.menu_project_config"
action="action_project_invoice_profile" groups="group_project_invoicing_profile"/>


</odoo>
Loading