[14.0][ADD] agreement_tier_validation

This commit is contained in:
Kitti U
2022-03-29 10:54:11 +07:00
parent 0766f02db6
commit d78b6787bd
17 changed files with 119 additions and 0 deletions

View File

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

View File

@@ -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"],
}

View File

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

View File

@@ -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

View File

@@ -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

View File

@@ -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.

View File

@@ -0,0 +1 @@
* Kitti U. <kittiu@ecosoft.co.th>

View File

@@ -0,0 +1,2 @@
This module extends the functionality of Agreement to support a tier
validation process.

View File

@@ -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>`_

View File

@@ -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.

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

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

View File

@@ -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)

View File

@@ -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>

View File

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

View File

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

1
test-requirements.txt Normal file
View File

@@ -0,0 +1 @@
odoo_test_helper