Merge pull request #127 from ursais/14.0_ADD_pms_project

[ADD] pms_project
This commit is contained in:
Maxime Chambreuil
2022-04-11 09:44:56 -05:00
committed by GitHub
17 changed files with 283 additions and 0 deletions

96
pms_project/README.rst Normal file
View File

@@ -0,0 +1,96 @@
=============
PMS - Project
=============
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpms-lightgray.png?logo=github
:target: https://github.com/OCA/pms/tree/14.0/pms_project
:alt: OCA/pms
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/pms-14-0/pms-14-0-pms_project
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/293/14.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
This module allows you to link projects and tasks to a property
**Table of contents**
.. contents::
:local:
Usage
=====
- Open a task and select the properties
- Open a property and click on “Tasks” to get the list of tasks related to the property
Bug Tracker
===========
Bugs are tracked on `GitHub Issues <https://github.com/OCA/pms/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/pms/issues/new?body=module:%20pms_project%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues.
Credits
=======
Authors
~~~~~~~
* Open Source Integrators
Contributors
~~~~~~~~~~~~
* Freni Patel <fpatel@opensourceintegrators.com>
* Open Source Integrators <http://www.opensourceintegrators.com>
* Serpent Consulting Services Pvt. Ltd. <support@serpentcs.com>
Other credits
~~~~~~~~~~~~~
The development of this module has been financially supported by:
* Open Source Integrators
Maintainers
~~~~~~~~~~~
This module is maintained by the OCA.
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
.. |maintainer-opensourceintegrators| image:: https://github.com/opensourceintegrators.png?size=40px
:target: https://github.com/opensourceintegrators
:alt: opensourceintegrators
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
|maintainer-opensourceintegrators|
This module is part of the `OCA/pms <https://github.com/OCA/pms/tree/14.0/pms_project>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

3
pms_project/__init__.py Normal file
View File

@@ -0,0 +1,3 @@
# Copyright (C) 2022 Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import models

View File

@@ -0,0 +1,15 @@
# Copyright (C) 2022 Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "PMS - Project",
"summary": "Link projects and tasks to properties",
"category": "Generic Modules/Property Management System",
"version": "14.0.1.0.0",
"license": "AGPL-3",
"depends": ["pms_base", "project"],
"author": "Open Source Integrators, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/pms",
"data": ["views/pms_property_views.xml", "views/project_task_views.xml"],
"maintainers": ["max3903"],
"development_status": "Beta",
}

View File

@@ -0,0 +1,4 @@
# Copyright (C) 2022 Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import project_task
from . import pms_property

View File

@@ -0,0 +1,11 @@
# Copyright (C) 2022 Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class PmsProperty(models.Model):
_inherit = "pms.property"
task_ids = fields.Many2many(
"project.task", "task_property_rel", "property_id", "task_id", string="Tasks"
)

View File

@@ -0,0 +1,15 @@
# Copyright (C) 2022 Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class ProjectTask(models.Model):
_inherit = "project.task"
pms_property_ids = fields.Many2many(
"pms.property",
"task_property_rel",
"task_id",
"property_id",
string="Properties",
)

View File

@@ -0,0 +1,8 @@
* Open Source Integrators <http://www.opensourceintegrators.com>
* Khalil Stanikzai <kstanikzai@opensourceintegrators.com>
* Maxime Chambreuil <mchambreuil@opensourceintegrators.com>
* Serpent Consulting Services Pvt. Ltd. <support@serpentcs.com>
* Freni Patel <fpatel@opensourceintegrators.com>

View File

@@ -0,0 +1,4 @@
The development of this module has been financially supported by:
* Casai
* Open Source Integrators

View File

@@ -0,0 +1 @@
This module allows you to link projects and tasks to a property.

View File

@@ -0,0 +1,12 @@
Project
* Go to Project > All Tasks
* Create or edit a task
* Go to the "Properties" tab
* Select the properties
Properties
* Go to Properties > Master Data > Properties
* Create or select a property
* Go to the “Tasks” tab to get the list of related tasks

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View File

@@ -0,0 +1,2 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from . import test_project_task

View File

@@ -0,0 +1,64 @@
# Copyright (C) 2022 Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.tests.common import TransactionCase
class TestProjectTask(TransactionCase):
def setUp(self):
super(TestProjectTask, self).setUp()
user_group_employee = self.env.ref("base.group_user")
user_group_project_user = self.env.ref("project.group_project_user")
self.partner_1 = self.env["res.partner"].create(
{"name": "Valid Lelitre", "email": "valid.lelitre@agrolait.com"}
)
self.project_pigs = (
self.env["project.project"]
.with_context({"mail_create_nolog": True})
.create(
{
"name": "Pigs",
"privacy_visibility": "employees",
"alias_name": "project+pigs",
"partner_id": self.partner_1.id,
}
)
)
self.user_projectuser = (
self.env["res.users"]
.with_context({"no_reset_password": True})
.create(
{
"name": "Armande ProjectUser",
"login": "Armande",
"email": "armande.projectuser@example.com",
"groups_id": [
(6, 0, [user_group_employee.id, user_group_project_user.id])
],
}
)
)
self.testtask = self.task_1 = (
self.env["project.task"]
.with_context({"mail_create_nolog": True})
.create(
{
"name": "Pigs UserTask",
"user_id": self.user_projectuser.id,
"project_id": self.project_pigs.id,
}
)
)
self.testproperty = self.env["pms.property"].create(
{"name": "test property", "owner_id": self.partner_1.id}
)
self.testproperty2 = self.env["pms.property"].create(
{"name": "test property2", "owner_id": self.partner_1.id}
)
def test_project_task_m2m(self):
self.testtask.pms_property_ids = [
(6, 0, [self.testproperty.id, self.testproperty2.id])
]
self.assertEqual(
self.testproperty.id in self.testtask.pms_property_ids.ids, True
)

View File

@@ -0,0 +1,25 @@
<odoo>
<record id="pms_property_views_form_project" model="ir.ui.view">
<field name="name">pms.property.form.project</field>
<field name="model">pms.property</field>
<field name="inherit_id" ref="pms_base.view_pms_property_form" />
<field name="arch" type="xml">
<xpath expr="//notebook" position="inside">
<page string="Tasks" name="Tasks">
<field name="task_ids" nolabel="1">
<tree editable="bottom">
<field name="name" />
<field name="project_id" invisible="1" />
<field name="company_id" invisible="1" />
<field name="user_id" />
<field name="date_deadline" />
<field name="stage_id" />
</tree>
</field>
</page>
</xpath>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,16 @@
<odoo>
<record id="view_task_form2_pms" model="ir.ui.view">
<field name="name">project.task.form.pms</field>
<field name="model">project.task</field>
<field name="inherit_id" ref="project.view_task_form2" />
<field name="arch" type="xml">
<xpath expr="//notebook" position="inside">
<page string="Properties" name="properties">
<field name="pms_property_ids" />
</page>
</xpath>
</field>
</record>
</odoo>

View File

@@ -0,0 +1 @@
../../../../pms_project

View File

@@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)