Skip to content

Commit

Permalink
[MIG] base_tier_validation_formula: Migrate to version 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sonhd91 committed Jan 10, 2024
1 parent 416b31b commit c2499af
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 30 deletions.
4 changes: 2 additions & 2 deletions base_tier_validation/models/res_config_settings.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Copyright 2021 Ecosoft Co., Ltd. (http://ecosoft.co.th)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models
from odoo import fields, models


class ResConfigSettings(models.TransientModel):
_inherit = "res.config.settings"

# Activate me back when modules are migrated

# module_base_tier_validation_formula = fields.Boolean(string="Tier Formula")
module_base_tier_validation_formula = fields.Boolean(string="Tier Formula")
# module_base_tier_validation_forward = fields.Boolean("Tier Forward & Backward")
# module_base_tier_validation_server_action = fields.Boolean("Tier Server Action")
# module_base_tier_validation_report = fields.Boolean("Tier Reports")
10 changes: 5 additions & 5 deletions base_tier_validation/views/res_config_settings_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
<field name="arch" type="xml">
<xpath expr="//div[@id='companies']" position="after">
<div id="base_tier_validation">
<!-- <block
<block
title="Tier Validation"
name="base_tier_validation_option_setting_container"
> -->
<!-- <setting id="module_base_tier_validation_formula">
>
<setting id="module_base_tier_validation_formula">
<field name="module_base_tier_validation_formula" />
<div class="text-muted">
Option to use python formula to get reviewers and find documents
</div>
</setting> -->
</setting>
<!-- <setting
id="module_base_tier_validation_server_action"
>
Expand All @@ -46,7 +46,7 @@
More reports about tier validations, i.e., summary of all my reviews
</div>
</setting> -->
<!-- </block> -->
</block>
</div>
</xpath>
</field>
Expand Down
5 changes: 3 additions & 2 deletions base_tier_validation_formula/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ Base Tier Validation Formula
!! source digest: sha256:30cc4c107c35bd82290d5c45d91bed36c8ee05555a66524b8381fa67848c99ba
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
.. |badge1| image:: https://img.shields.io/badge/maturity-Mature-brightgreen.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
:alt: Mature
.. |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
Expand Down Expand Up @@ -78,6 +78,7 @@ Contributors
- `Trobz <https://trobz.com>`__:

- Hoang Diep <[email protected]>
- Son Ho <[email protected]>

Other credits
-------------
Expand Down
4 changes: 3 additions & 1 deletion base_tier_validation_formula/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
"name": "Base Tier Validation Formula",
"summary": """
Formulas for Base tier validation""",
"version": "16.0.1.0.2",
"version": "17.0.1.0.0",
"category": "Tools",
"license": "AGPL-3",
"development_status": "Mature",
"author": "Creu Blanca,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/server-ux",
"depends": ["base_tier_validation"],
Expand Down
2 changes: 1 addition & 1 deletion base_tier_validation_formula/models/tier_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class TierDefinition(models.Model):

@api.onchange("review_type")
def onchange_review_type(self):
res = super(TierDefinition, self).onchange_review_type()
res = super().onchange_review_type()
self.reviewer_expression = (
"# Available locals:\n"
"# - rec: current record\n"
Expand Down
1 change: 1 addition & 0 deletions base_tier_validation_formula/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
- [Trobz](https://trobz.com):

> - Hoang Diep \<<[email protected]>\>
> - Son Ho \<<[email protected]>\>
3 changes: 2 additions & 1 deletion base_tier_validation_formula/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -424,14 +424,15 @@ <h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
<blockquote>
<ul class="simple">
<li>Hoang Diep &lt;<a class="reference external" href="mailto:hoang&#64;trobz.com">hoang&#64;trobz.com</a>&gt;</li>
<li>Son Ho &lt;<a class="reference external" href="mailto:sonhd&#64;trobz.com">sonhd&#64;trobz.com</a>&gt;</li>
</ul>
</blockquote>
</li>
</ul>
</div>
<div class="section" id="other-credits">
<h2><a class="toc-backref" href="#toc-entry-6">Other credits</a></h2>
<p>The migration of this module from 15.0 to 16.0 was financially supported
<p>The migration of this module from 16.0 to 17.0 was financially supported
by Camptocamp</p>
</div>
<div class="section" id="maintainers">
Expand Down
18 changes: 4 additions & 14 deletions base_tier_validation_formula/tests/test_tier_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
class TierTierValidation(common.TransactionCase):
@classmethod
def setUpClass(cls):
super(TierTierValidation, cls).setUpClass()
super().setUpClass()
cls.env = cls.env(context=dict(cls.env.context, **DISABLED_MAIL_CONTEXT))
cls.loader = FakeModelLoader(cls.env, cls.__module__)
cls.loader.backup_registry()
Expand All @@ -41,19 +41,9 @@ def setUpClass(cls):
}
)

cls.test_user_1 = cls.env.ref("base.user_admin")
cls.test_user_2 = cls.env.ref("base.user_demo")
# Create users:
group_ids = cls.env.ref("base.group_system").ids
cls.test_user_1 = cls.env["res.users"].create(
{
"name": "John",
"login": "test1",
"groups_id": [(6, 0, group_ids)],
"email": "[email protected]",
}
)
cls.test_user_2 = cls.env["res.users"].create(
{"name": "Mike", "login": "test2", "email": "[email protected]"}
)
cls.test_user_3 = cls.env["res.users"].create(
{"name": "Mary", "login": "test3", "email": "[email protected]"}
)
Expand All @@ -74,7 +64,7 @@ def setUpClass(cls):
@classmethod
def tearDownClass(cls):
cls.loader.restore_registry()
return super(TierTierValidation, cls).tearDownClass()
return super().tearDownClass()

def test_01_reviewer_from_python_expression(self):
tier_definition = self.tier_def_obj.create(
Expand Down
10 changes: 6 additions & 4 deletions base_tier_validation_formula/views/tier_definition_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,21 @@
<field
name="reviewer_expression"
colspan="4"
attrs="{'invisible': [('review_type', '!=', 'expression')]}"
invisible="review_type != 'expression'"
/>
</group>
</xpath>
<xpath expr="//field[@name='definition_domain']" position="attributes">
<attribute
name="attrs"
>{'invisible': [('definition_type', 'not in', ('domain', 'domain_formula'))]}</attribute>
name="invisible"
>definition_type not in ('domain', 'domain_formula')</attribute>
</xpath>
<field name="definition_domain" position="after">
<field
name="python_code"
attrs="{'invisible': [('definition_type', 'not in', ('formula', 'domain_formula'))]}"
widget="code"
options="{'mode': 'python'}"
invisible="definition_type not in ('formula', 'domain_formula')"
/>
</field>
</field>
Expand Down

0 comments on commit c2499af

Please sign in to comment.