Skip to content

Commit

Permalink
[14.0][ADD] agreement_tier_validation
Browse files Browse the repository at this point in the history
  • Loading branch information
kittiu committed Jun 20, 2022
1 parent 0766f02 commit d78b678
Show file tree
Hide file tree
Showing 17 changed files with 119 additions and 0 deletions.
3 changes: 3 additions & 0 deletions agreement_tier_validation/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import models
16 changes: 16 additions & 0 deletions agreement_tier_validation/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2022 Ecosoft Co., Ltd.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Agreement Tier Validation",
"summary": "Extends the functionality of Agreement to "
"support a tier validation process.",
"version": "14.0.1.0.0",
"category": "Contract Management",
"website": "https://github.com/OCA/contract",
"author": "Ecosoft, Odoo Community Association (OCA)",
"license": "AGPL-3",
"application": False,
"installable": True,
"depends": ["agreement_legal", "base_tier_validation"],
"data": ["views/agreement_view.xml"],
}
4 changes: 4 additions & 0 deletions agreement_tier_validation/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import agreement
from . import tier_definition
13 changes: 13 additions & 0 deletions agreement_tier_validation/models/agreement.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2022 Ecosoft Co., Ltd.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import models


class Agreement(models.Model):
_name = "agreement"
_inherit = ["agreement", "tier.validation"]
_state_from = ["draft"]
_state_to = ["active"]

_tier_validation_manual_config = False
14 changes: 14 additions & 0 deletions agreement_tier_validation/models/tier_definition.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2022 Ecosoft Co., Ltd.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import api, models


class TierDefinition(models.Model):
_inherit = "tier.definition"

@api.model
def _get_tier_validation_model_names(self):
res = super(TierDefinition, self)._get_tier_validation_model_names()
res.append("agreement")
return res
4 changes: 4 additions & 0 deletions agreement_tier_validation/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
To configure this module, you need to:

#. Go to *Settings > Technical > Tier Validations > Tier Definition*.
#. Create as many tiers as you want for Agreement model.
1 change: 1 addition & 0 deletions agreement_tier_validation/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Kitti U. <[email protected]>
2 changes: 2 additions & 0 deletions agreement_tier_validation/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module extends the functionality of Agreement to support a tier
validation process.
2 changes: 2 additions & 0 deletions agreement_tier_validation/readme/INSTALL.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module depends on ``base_tier_validation``. You can find it at
`OCA/server-ux <https://github.com/OCA/server-ux>`_
14 changes: 14 additions & 0 deletions agreement_tier_validation/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
To use this module, you need to:

#. Create a Agreement triggering at least one "Tier Definition".
#. Click on *Request Validation* button.
#. Under the tab *Reviews* have a look to pending reviews and their statuses.
#. Once all reviews are validated the State can be set to "active".

Additional features:

* You can filter the Agreement requesting your review through the filter *Needs my
Review*.
* User with rights to confirm the Agreement (validate all tiers that would
be generated) can directly do the operation, this is, there is no need for
her/him to request a validation.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions agreement_tier_validation/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import test_tier_validation
10 changes: 10 additions & 0 deletions agreement_tier_validation/tests/test_tier_validation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright 2022 Ecosoft Co., Ltd.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).

from odoo.addons.base_tier_validation.tests.common import CommonTierValidation


class TestAgreementTierValidation(CommonTierValidation):
def test_01_tier_definition_models(self):
res = self.tier_def_obj._get_tier_validation_model_names()
self.assertIn("agreement", res)
25 changes: 25 additions & 0 deletions agreement_tier_validation/views/agreement_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="view_agreement_filter" model="ir.ui.view">
<field name="name">agreement.select - agreement_tier_validation</field>
<field name="model">agreement</field>
<field name="inherit_id" ref="agreement_legal.partner_agreement_search_view" />
<field name="arch" type="xml">
<filter name="filter_templates" position="after">
<separator />
<filter
name="needs_review"
string="Needs my Review"
domain="[('reviewer_ids','in',uid), ('state', 'not in', ['active', 'inactive'])]"
help="My Areements to review"
/>
<filter
name="tier_validated"
string="Validated"
domain="[('validated', '=', True)]"
help="Agreements validated and ready to be active"
/>
</filter>
</field>
</record>
</odoo>
6 changes: 6 additions & 0 deletions setup/agreement_tier_validation/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
1 change: 1 addition & 0 deletions test-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
odoo_test_helper

0 comments on commit d78b678

Please sign in to comment.