Skip to content

Commit

Permalink
Merge PR #737 into 15.0
Browse files Browse the repository at this point in the history
Signed-off-by pedrobaeza
  • Loading branch information
OCA-git-bot committed Oct 24, 2023
2 parents 4604e4a + effe061 commit 2ebb41c
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 53 deletions.
31 changes: 20 additions & 11 deletions base_tier_validation/i18n/base_tier_validation.pot
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-10-24 06:38+0000\n"
"PO-Revision-Date: 2023-10-24 06:38+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
Expand Down Expand Up @@ -293,16 +295,6 @@ msgid ""
"definition is triggered."
msgstr ""

#. module: base_tier_validation
#: model:ir.model.fields,field_description:base_tier_validation.field_tier_definition__archive_uid
msgid "Last Archived by"
msgstr ""

#. module: base_tier_validation
#: model:ir.model.fields,field_description:base_tier_validation.field_tier_definition__archive_date
msgid "Last Archived on"
msgstr ""

#. module: base_tier_validation
#: model:ir.model.fields,field_description:base_tier_validation.field_comment_wizard____last_update
#: model:ir.model.fields,field_description:base_tier_validation.field_tier_definition____last_update
Expand Down Expand Up @@ -405,6 +397,7 @@ msgstr ""
#. openerp-web
#: code:addons/base_tier_validation/static/src/xml/systray.xml:0
#: model:ir.model.fields.selection,name:base_tier_validation.selection__tier_review__status__pending
#: model:ir.model.fields.selection,name:base_tier_validation.selection__tier_validation__validation_status__pending
#, python-format
msgid "Pending"
msgstr ""
Expand All @@ -422,6 +415,7 @@ msgstr ""
#. module: base_tier_validation
#: model:ir.model.fields,field_description:base_tier_validation.field_tier_validation__rejected
#: model:ir.model.fields.selection,name:base_tier_validation.selection__tier_review__status__rejected
#: model:ir.model.fields.selection,name:base_tier_validation.selection__tier_validation__validation_status__rejected
msgid "Rejected"
msgstr ""

Expand Down Expand Up @@ -517,7 +511,6 @@ msgstr ""
#. openerp-web
#: code:addons/base_tier_validation/static/src/xml/tier_review_template.xml:0
#: model:ir.model.fields,field_description:base_tier_validation.field_tier_definition__sequence
#: model:ir.model.fields,field_description:base_tier_validation.field_tier_review__sequence
#, python-format
msgid "Sequence"
msgstr ""
Expand Down Expand Up @@ -567,6 +560,11 @@ msgid ""
"Please request a validation."
msgstr ""

#. module: base_tier_validation
#: model:ir.model.fields,field_description:base_tier_validation.field_tier_review__sequence
msgid "Tier"
msgstr ""

#. module: base_tier_validation
#: model:ir.actions.act_window,name:base_tier_validation.tier_definition_action
#: model:ir.model,name:base_tier_validation.model_tier_definition
Expand Down Expand Up @@ -674,6 +672,7 @@ msgstr ""

#. module: base_tier_validation
#: model:ir.model.fields,field_description:base_tier_validation.field_tier_validation__validated
#: model:ir.model.fields.selection,name:base_tier_validation.selection__tier_validation__validation_status__validated
msgid "Validated"
msgstr ""

Expand All @@ -696,11 +695,21 @@ msgstr ""
msgid "Validation Date"
msgstr ""

#. module: base_tier_validation
#: model:ir.model.fields,field_description:base_tier_validation.field_tier_validation__validation_status
msgid "Validation Status"
msgstr ""

#. module: base_tier_validation
#: model:ir.model.fields,field_description:base_tier_validation.field_tier_validation__review_ids
msgid "Validations"
msgstr ""

#. module: base_tier_validation
#: model:ir.model.fields.selection,name:base_tier_validation.selection__tier_validation__validation_status__no
msgid "Without validation"
msgstr ""

#. module: base_tier_validation
#: model_terms:ir.ui.view,arch_db:base_tier_validation.tier_definition_view_form
msgid "e.g. Tier Validation for..."
Expand Down
61 changes: 23 additions & 38 deletions base_tier_validation/i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2021-03-16 11:46+0000\n"
"POT-Creation-Date: 2023-10-24 06:38+0000\n"
"PO-Revision-Date: 2023-10-24 08:41+0200\n"
"Last-Translator: Ana Suárez <[email protected]>\n"
"Language-Team: none\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.3.2\n"
"X-Generator: Poedit 3.0.1\n"

#. module: base_tier_validation
#. openerp-web
Expand Down Expand Up @@ -312,16 +313,6 @@ msgstr ""
"Si está establecido, todos los posibles validadores serán notificados por "
"email cuando esta definición se ejecute."

#. module: base_tier_validation
#: model:ir.model.fields,field_description:base_tier_validation.field_tier_definition__archive_uid
msgid "Last Archived by"
msgstr ""

#. module: base_tier_validation
#: model:ir.model.fields,field_description:base_tier_validation.field_tier_definition__archive_date
msgid "Last Archived on"
msgstr ""

#. module: base_tier_validation
#: model:ir.model.fields,field_description:base_tier_validation.field_comment_wizard____last_update
#: model:ir.model.fields,field_description:base_tier_validation.field_tier_definition____last_update
Expand Down Expand Up @@ -425,6 +416,7 @@ msgstr ""
#. openerp-web
#: code:addons/base_tier_validation/static/src/xml/systray.xml:0
#: model:ir.model.fields.selection,name:base_tier_validation.selection__tier_review__status__pending
#: model:ir.model.fields.selection,name:base_tier_validation.selection__tier_validation__validation_status__pending
#, python-format
msgid "Pending"
msgstr "Pendiente"
Expand All @@ -442,6 +434,7 @@ msgstr "Rechazar"
#. module: base_tier_validation
#: model:ir.model.fields,field_description:base_tier_validation.field_tier_validation__rejected
#: model:ir.model.fields.selection,name:base_tier_validation.selection__tier_review__status__rejected
#: model:ir.model.fields.selection,name:base_tier_validation.selection__tier_validation__validation_status__rejected
msgid "Rejected"
msgstr "Rechazado"

Expand Down Expand Up @@ -479,19 +472,16 @@ msgstr "Solicitado Por"

#. module: base_tier_validation
#: model:ir.model.fields,field_description:base_tier_validation.field_comment_wizard__res_id
#, fuzzy
msgid "Res"
msgstr "Revisiones"

#. module: base_tier_validation
#: model:ir.model.fields,field_description:base_tier_validation.field_comment_wizard__res_model
#, fuzzy
msgid "Res Model"
msgstr "Modelo"

#. module: base_tier_validation
#: model_terms:ir.ui.view,arch_db:base_tier_validation.tier_validation_buttons
#, fuzzy
msgid "Restart Validation"
msgstr "Volver a empezar validación"

Expand Down Expand Up @@ -540,7 +530,6 @@ msgstr "Revisiones"
#. openerp-web
#: code:addons/base_tier_validation/static/src/xml/tier_review_template.xml:0
#: model:ir.model.fields,field_description:base_tier_validation.field_tier_definition__sequence
#: model:ir.model.fields,field_description:base_tier_validation.field_tier_review__sequence
#, python-format
msgid "Sequence"
msgstr "Secuencia"
Expand Down Expand Up @@ -592,6 +581,11 @@ msgstr ""
"Esta acción necesita ser validada para algún registro.\n"
"Por favor, solicita una validación."

#. module: base_tier_validation
#: model:ir.model.fields,field_description:base_tier_validation.field_tier_review__sequence
msgid "Tier"
msgstr "Nivel"

#. module: base_tier_validation
#: model:ir.actions.act_window,name:base_tier_validation.tier_definition_action
#: model:ir.model,name:base_tier_validation.model_tier_definition
Expand Down Expand Up @@ -692,7 +686,7 @@ msgstr ""
#. module: base_tier_validation
#: model_terms:ir.ui.view,arch_db:base_tier_validation.tier_validation_label
msgid "Validate"
msgstr ""
msgstr "Validado"

#. module: base_tier_validation
#: model:ir.model.fields,field_description:base_tier_validation.field_comment_wizard__validate_reject
Expand All @@ -702,6 +696,7 @@ msgstr "Validado"

#. module: base_tier_validation
#: model:ir.model.fields,field_description:base_tier_validation.field_tier_validation__validated
#: model:ir.model.fields.selection,name:base_tier_validation.selection__tier_validation__validation_status__validated
msgid "Validated"
msgstr "Validado"

Expand All @@ -724,32 +719,22 @@ msgstr "Validado por"
msgid "Validation Date"
msgstr "Fecha de Validación"

#. module: base_tier_validation
#: model:ir.model.fields,field_description:base_tier_validation.field_tier_validation__validation_status
msgid "Validation Status"
msgstr "Estado de validación"

#. module: base_tier_validation
#: model:ir.model.fields,field_description:base_tier_validation.field_tier_validation__review_ids
msgid "Validations"
msgstr "Validaciones"

#. module: base_tier_validation
#: model:ir.model.fields.selection,name:base_tier_validation.selection__tier_validation__validation_status__no
msgid "Without validation"
msgstr "Sin validación"

#. module: base_tier_validation
#: model_terms:ir.ui.view,arch_db:base_tier_validation.tier_definition_view_form
msgid "e.g. Tier Validation for..."
msgstr "ej. Validación de Nivel por..."

#~ msgid "Tier"
#~ msgstr "Nivel"

#~ msgid "A review was rejected by {}. ({})"
#~ msgstr "Una revisión fue rechaza por {}. ({})"

#~ msgid "Any user in a specific group."
#~ msgstr "Cualquier usuario en el grupo especificado."

#, fuzzy
#~| msgid "Sequence"
#~ msgid "Approve Sequence"
#~ msgstr "Secuencia"

#~ msgid "Formula"
#~ msgstr "Fórmula"

#~ msgid "Python Expression"
#~ msgstr "Expresión Python"
28 changes: 28 additions & 0 deletions base_tier_validation/models/tier_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,28 @@ class TierValidation(models.AbstractModel):
auto_join=True,
)
to_validate_message = fields.Html(compute="_compute_validated_rejected")
# TODO: Delete in v17 in favor of validation_status field
validated = fields.Boolean(
compute="_compute_validated_rejected", search="_search_validated"
)
validated_message = fields.Html(compute="_compute_validated_rejected")
need_validation = fields.Boolean(compute="_compute_need_validation")
# TODO: Delete in v17 in favor of validation_status field
rejected = fields.Boolean(
compute="_compute_validated_rejected", search="_search_rejected"
)
rejected_message = fields.Html(compute="_compute_validated_rejected")
# Informative field (used in purchase_tier_validation), will be reliable as of v17
validation_status = fields.Selection(
selection=[
("no", "Without validation"),
("pending", "Pending"),
("rejected", "Rejected"),
("validated", "Validated"),
],
default="no",
compute="_compute_validation_status",
)
reviewer_ids = fields.Many2many(
string="Reviewers",
comodel_name="res.users",
Expand Down Expand Up @@ -165,6 +178,21 @@ def _compute_validated_rejected(self):
rec.rejected_message = rec._get_rejected_message()
rec.to_validate_message = rec._get_to_validate_message()

def _compute_validation_status(self):
for item in self:
if item.validated and not item.rejected:
item.validation_status = "validated"
elif not item.validated and item.rejected:
item.validation_status = "rejected"
elif (
not item.validated
and not item.rejected
and any(item.review_ids.filtered(lambda x: x.status == "pending"))
):
item.validation_status = "pending"
else:
item.validation_status = "no"

def _compute_next_review(self):
for rec in self:
review = rec.review_ids.sorted("sequence").filtered(
Expand Down
10 changes: 8 additions & 2 deletions base_tier_validation/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,15 @@ def setUpClass(cls):

cls.loader = FakeModelLoader(cls.env, cls.__module__)
cls.loader.backup_registry()
from .tier_validation_tester import TierValidationTester, TierValidationTester2
from .tier_validation_tester import (
TierDefinition,
TierValidationTester,
TierValidationTester2,
)

cls.loader.update_registry((TierValidationTester, TierValidationTester2))
cls.loader.update_registry(
(TierValidationTester, TierValidationTester2, TierDefinition)
)

cls.test_model = cls.env[TierValidationTester._name]
cls.test_model_2 = cls.env[TierValidationTester2._name]
Expand Down
13 changes: 12 additions & 1 deletion base_tier_validation/tests/tier_validation_tester.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 2018-19 ForgeFlow S.L. (https://www.forgeflow.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models
from odoo import api, fields, models


class TierValidationTester(models.Model):
Expand Down Expand Up @@ -44,3 +44,14 @@ class TierValidationTester2(models.Model):

def action_confirm(self):
self.write({"state": "confirmed"})


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

@api.model
def _get_tier_validation_model_names(self):
res = super()._get_tier_validation_model_names()
res.append("tier.validation.tester")
res.append("tier.validation.tester2")
return res
6 changes: 5 additions & 1 deletion base_tier_validation_forward/tests/test_tier_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@ def setUpClass(cls):
cls.loader = FakeModelLoader(cls.env, cls.__module__)
cls.loader.backup_registry()
from odoo.addons.base_tier_validation.tests.tier_validation_tester import (
TierDefinition,
TierValidationTester,
TierValidationTester2,
)

cls.loader.update_registry((TierValidationTester,))
cls.loader.update_registry(
(TierValidationTester, TierValidationTester2, TierDefinition)
)
cls.test_model = cls.env[TierValidationTester._name]

cls.tester_model = cls.env["ir.model"].search(
Expand Down

0 comments on commit 2ebb41c

Please sign in to comment.